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

73
Views
select tag not working when rendering from js

I've used below code to get select value, but when I select any option, I'm getting correct value in console but in the UI select option is not changing.

script.js

    html += '<thead><tr>';
    html += '<td colspan="4">';
    html += '<select id="selectedMonth" onchange="getMonthAndYear()">';
    for (var i = 0; i < this.Months.length; i++) {
        html += '<option value="' + this.Months[i] + '">' + this.Months[i] + '</option>';
    }
    html += '</select>';
    html += '</td>';

**********************************************************************

function getMonthAndYear() {
    var selectedMonth = document.getElementById('selectedMonth').value;
    console.log("I'm getting this value correctly: " + selectedMonth);
}

Please this GIF - https://i.ibb.co/5jGDyBn/gif-20220105-214557.gif

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!