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

188
Views
Get value from input several times without refreshing the page

I have an input and a button. When I clicked the button I want to take the value from input and put it into a variable. How can do this action several times without refreshing the page ? Example: Input: John Button: click let x = John -->without refreshing the page Input: Bob Button: click let x = Bob

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You need a variable to store the value of the input and a function that is being called when the button is clicked. name in this example holds the value of the input and is updated everytime the button is clicked.

let name;
document.querySelector("#btn").addEventListener("click", () => {
  name = document.querySelector("#name").value;
  console.log(name);
});
<input id="name" />
<button id="btn">Click me</button>

about 4 years ago · Juan Pablo Isaza Report
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!