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

213
Views
Why i am getting undefined my code output

I trying to access value from the input tag but output is showing me null or undefined in console.

<div class="ui-widget">
       <div class="searchbar">
             <input type="text" id="tags" placeholder="Search for a state...">
       </div>
             button type="button" id="add-btn-data" onclick="addstate()">add</button>
</div>
var inputstate = document.getElementById('tags').value;
function addstate(){
    console.log(inputstate);
}
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!