0

I have following JSON Data

{"Date Created":"date_entered","Date Modified":"date_modified","Description":"description"}

How do I populate dropdown with jquery using this json data ?

1 Answer 1

1

Assuming data has already been parsed to javascript object, you need to loop over object keys and construct html something like:

var html='<option value=""></option>';
for(key in data){
    html += '<option value="' + data[key] + '">' + key + '</option>';
}
$('#mySelect').html( html );

DEMO

Sign up to request clarification or add additional context in comments.

1 Comment

Great solution. Helped me beyond my need.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.