62
rated 0 times
[
67]
[
5]
/ answers: 1 / hits: 31706
/ 10 Years ago, sun, july 20, 2014, 12:00:00
Is there any function to set value of a <select>
tag option? I have an ajax response array and I want to put this array in a <select>
tag.
This is my code :
$.ajax({
type: GET,
url: http://.......api/1/AbsenceType,
dataType: json,
success: function (data) {
// It doesn't work
var ind = document.getElementById('mySelect').selectedIndex;
document.getElementById('mySelect').options.value=2;//
}
})
And my select tag is :
<select id=mySelect name=mySelect required=required data-mini =true onchange=myFunction3();/>
<option id =type value=></option>
</select>
More From » ajax