Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

201
Views
Is it possible to import values from an index.html to a .js file?(using parcel js)

My question is: from the index.html file below:

<html>
<body>
  <div id="account"></div>
  <script type = "module" script src="./index.js"></script>
  <link rel="stylesheet" href="./index.scss">
  <div class="send">
  <h1> Send VeggieToken </h1>
  <input id="Amount" placeholder="Send Amount" />
  <br>
  <input  id="recipient" placeholder="Enter Recipient" />
  <br>
  <button onclick="fn1()" id = "btn1">Transfer</button>
  <br>

  </div>
</div>
</div>
</body>
<script>
function fn1(){
  var str = document.getElementById("recipient").value;
  var amount = document.getElementById("Amount").value;
  alert("Transferred Amount:" + amount);
}
</script>
</html>

I would like to import the variables str and amount when a button is clicked into a separate server file index.js. Does anyone know how to do so?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!