JQuery Dropdown Select Event
Is there a specific event for when a user selects an item in a dropdown box? I am creating a fairly large form that uses multiple dropdown boxes. On load all but the first are disa
Solution 1:
Try Below code:
<select id="drop1">
<option value="volvo">Volvo</option>
<option value="saab">Saab</option>
<option value="mercedes">Mercedes</option>
<option value="audi">Audi</option>
</select>
<select id="drop2"></select>
Jquery
$(document).ready(function(){
$("#drop2").attr("disabled", true);
$("#drop1").change(function(){
$("#drop2").attr("disabled", false);
//Put your ajax code here and bind like below code
$("#drop2").append(new Option("option text", "value"));
$("#drop2").append(new Option("xxx","1"));
});
});
Post a Comment for "JQuery Dropdown Select Event"