I only know we can have a each loop and add <option ...> one by one into a <select> element.
Is there any binding like $('select#name').val(data)?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
jQuery doesn’t have any methods for this by default. Either you can use a plugin like the one given below
http://www.rvdevsign.net/ressources/javascript/documentation-jquery-jselect.html
Or pass options string
<option>abc</option><option>def</option>from server-side code and append it to select element using$('select#name').html(response).I would suggest you not to hesitate to write loop for this as a loop is required somewhere even if you use any of the methods mentioned above.