开发者

Disable the first value in the select list on checkbox click

开发者 https://www.devze.com 2023-01-03 02:24 出处:网络
$(\'#bit_IsModule\').click(function () { if ($(\'#bit_IsModule:checked\').val() == \"true\") $(\"#featurename\").slideUp();
  $('#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

精彩评论

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