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

293
Views
Get Value of a BootStrap dropdown onChange in JavaScript

I want to call my JavaScript function based on the dropdown value selected. This is what I have, but when I click on age or the other value, nothing changes. Am i missing something?

  <div class="container d-flex justify-content-center">
        
            <div class="dropdown">
              <button class="btn btn-secondary dropdown-toggle mr-2" type="button" id="data" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
                Search Data
              </button>
              <div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
                <a class="dropdown-item" href="#">Age</a>
                <a class="dropdown-item" href="#">Gender</a>
              </div>
            </div>
    ```

JS:

    const data = document.getElementById("data").value;
    
    data.addEventListener("change", (event) =>
      usersFetch(`http://pip-data:8000/v1/content/${event.target.value}`)
    );
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!