javascript - Jquery Disable option in dropdown -
guys have used following code disable option using jquery (jquery-1.4.2.min).the disable happens in firefox , not in ie.
<select name="scope" id="scope"> <option value="g"> global <option value="d"> dynamic </select> $("#scope option[value='g']").attr("disabled","disabled"); $("#scope option[value='d']").attr("selected", "selected");
i think might wrong because select rather option can disabled. since firefox great , ie sucks, can guess why :) having problem. use css grey out text of option.
then on jquery this.
$('#scope').change(function(){ if($('#scope option[value="'+$(this).val()+'"]').attr('disabled') == 'disabled'){ alert('its disabled cannot select option'); } });
btw. double check code have not tested :)
Comments
Post a Comment