How to get input value through onblur event?
P粉818088880
P粉818088880 2024-04-03 08:55:32
0
1
371

I'm trying to get the value input via onblur event but it doesn't work when I use JS module.

<!DOCTYPE html>
<html lang="en">
     <head>
          <meta charset="UTF-8" />
          <meta http-equiv="X-UA-Compatible" content="IE=edge" />
          <meta name="viewport" content="width=device-width, initial-scale=1.0" />
          <title>Calculadora de receitas e despesas</title>
          <script type="module" src="main.js"></script>
     </head>
<body>
  <table> 
      <tr>
               <td >Franchise Fee</td>
               <td class="value">
                    <input type="input" class="form__field" placeholder="R$" name="franchise-fee" id='franchiseFee' onblur="getFranchiseFee()" required />
               </td>
      </tr>
   </table>
</body>

GetElements.mjs module file:

function getFranchiseFee(franchiseFee){
    franchiseFee = document.getElementById('franchiseFee');
    // console.log(franchiseFee.value);
    return parseFloat(franchiseFee.value);
}
export {getFranchiseFee};

main.js file:

import {getFranchiseFee} from './GetElement.mjs';

console.log(getFranchiseFee());

I tried to display the entered value on the console log using a function in the module and print it using the console log in the main.js file.

Now displays an error message telling you that this is not possible

P粉818088880
P粉818088880

reply all(1)
P粉029327711

I copied the wrong export here but it is correct now. This is not a problem

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!