javascript - How to disable some drop downs until the first/main drop down is selected? -
i have 4 drop downs in form display results "main" dropdown should selected. question how should disable other dropdowns until user selects option specific dropdown?
**main** <select class="form-control" name="make"> <option><option> </select> **others** <select class="form-control" name="model"> <option><option> </select> <select class="form-control" name="year"> <option><option> </select> <select class="form-control" name="price"> <option><option> </select>
first disable 3 drop-down menus. , enable them upon changes of main menu simple jquery.
working example: http://jsfiddle.net/kny2t/
<select class="form-control" name="make"> <option><option> </select> <select class="form-control" name="model" disabled> <option><option> </select> <select class="form-control" name="year" disabled> <option><option> </select> <select class="form-control" name="price" disabled> <option><option> </select>
jquery:
$("select[name='make']").change( function() { $("select[name='model']").removeattr("disabled"); $("select[name='year']").removeattr("disabled"); $("select[name='price']").removeattr("disabled"); });
Comments
Post a Comment