Skip to content Skip to sidebar Skip to footer

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:

<selectid="drop1"><optionvalue="volvo">Volvo</option><optionvalue="saab">Saab</option><optionvalue="mercedes">Mercedes</option><optionvalue="audi">Audi</option></select><selectid="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(newOption("option text", "value"));
    $("#drop2").append(newOption("xxx","1"));        
});
});

Demo: http://jsfiddle.net/J5kmz/

Post a Comment for "Jquery Dropdown Select Event"