Friday 15 May 2015

javascript - How to Select first index of first combobox and disable other comboboxes and reset the values of other combobox with jQuery? -



javascript - How to Select first index of first combobox and disable other comboboxes and reset the values of other combobox with jQuery? -

i have 3 combobxes. comboboxes have values : "select","one","two""three"

here screnario :

if "select" selected first combobox, should disable comboboxes , reset values first index.

jquery $("select").change(function(e){ if($("#box_g1 option:selected").prop("selectedindex",0)){ $("#box_g2").attr("disabled", true); $("#box_g3").attr("disabled", true); // , on $("#box_g5").attr("disabled", true); } }); html <select name="n1" id="box_g1"> <option value="select">select</option> <option value="a">a</option> <option value="b">b</option> <option value="c">c</option> </select> <select name="n2" id="box_g2"> <option value="disabled">disabled</option> <option value="a">a</option> <option value="b">b</option> <option value="c">c</option> </select> <select name="n3" id="box_g3"> <option value="disabled">disabled</option> <option value="a">a</option> <option value="b">b</option> <option value="c">c</option> </select>

here box_g1 first combobox. , disabling other comboboxes 2 5.

try this:

$("select").change(function(e){ if($("#box_g1").val() == "select"){ $("#box_g2").attr("disabled", "disabled"); $("#box_g3").attr("disabled", "disabled"); // , on $("#box_g5").attr("disabled", "disabled"); } });

demo fiddle

javascript jquery combobox

No comments:

Post a Comment