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

276
Views
Add EventListner not working in google chrome

I'm trying to execute a function as soon as an option is selected. My code works flawlessly in Firefox but there's no response or error in Google Chrome. I have tried different solutions found on StackOverflow but nothing helped. The solutions I tried include adding javascript as an external file. I tried Using window.addEventListener but nothing is working in chrome.

EDITED(THE SOLUTIONS I TRIED):

solution 1

solution 2

solution 3

HTML:

<div class="col-12">
<label for="username" class="form-label">Select Plan</label>
<select id="selections" class="form-select" aria-label="Default select example">
    <option class="dropdown_option" id="1" value="plan1">plan1</option>
    <option class="dropdown_option" id="2" value="plan2">plan2</option>
    <option class="dropdown_option" id="3" value="plan3">plan3</option>
    <option class="dropdown_option" id="4" value="plan4">plan4</option>
</select>
</div>

JS(EDITED):

h = document.getElementsByClassName('dropdown_option');

for (var i = 0; i < h.length; i++) {
    h[i].addEventListener('click', function() {
        console.log(this.innerHTML);
        retrieveplans(this.innerHTML);
    })
}
about 4 years ago · Santiago Gelvez
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!