开发者

Disable the first value in the select list on checkbox click

  $('#bit_IsModule').click(function () {
        if ($('#bit_IsModule:checked').val() == "true")

            $("#featurename").slideUp();
        else
            $("#featurename").slideDown();
    });

I want to disable the fir开发者_如何学JAVAst value in the select list on the checkbox click ? how can i do that


This should do the trick, #select_id is the name of your select.

$('#bit_IsModule').click(function () {
    if( $(this).attr('checked') ) {
        $('#select_id option:first').attr( 'disabled', true );
        $("#featurename").slideUp();
    } else {
        $('#select_id option:first').attr( 'disabled', false );
        $("#featurename").slideDown();
    }
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜