javascript - Selecting selectbox options by array values -
i getting values via json type ajax request jquery. when use alert(msg.options)
alerts ["1","3","8"]
if use below script select needed options, works. selects options have value 1 , 3 , 8 :
$('#input_6').val(["1","3","8"]);
but below script doesn't work if alerts same:
$('#input_6').val(msg.options);
how can fix this? thank you...
try:
$('#input_6').val($.parsejson(msg.options));
Comments
Post a Comment