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

315
Views
How to create dropdown list dynamically using jQuery?

How do you create a dropdown list dynamically using jQuery? By dropdown list, I mean a <select> with its associated <option> values.

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

Just create the elements like any element.

Example:

var data = {
    'foo': 'bar',
    'foo2': 'baz'
}


var s = $('<select />');

for(var val in data) {
    $('<option />', {value: val, text: data[val]}).appendTo(s);
}

s.appendTo('body'); // or wherever it should be
over 4 years ago · Santiago Trujillo Report

0

In its simplest form,

var opt = "<option> -- Select -- </option>";

$(opt).wrap('<select />');

$('#some-container-div').html(opt);
over 4 years ago · Santiago Trujillo Report

0

http://hungred.com/how-to/tutorial-jquery-select-box-manipulation-plugin/

over 4 years ago · Santiago Trujillo 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!