开发者

How to Disable image button

开发者 https://www.devze.com 2022-12-09 05:06 出处:网络
I have an button whose type is image i want to disable button till some action following is the html tag

I have an button whose type is image i want to disable button till some action following is the html tag

How to 开发者_如何学JAVAdisable this button?


You can add a click that returns false:

$('#myButton').click(function() { return false; });

You might want to add a message that explains why it's disabled, and possibly some CSS to make it look disabled as well.


This is the code I use to disable or re-enable a control:

function handleControlDisplay(className, foundCount, checked) {



    var button = jQuery(className);



    if (foundCount > 0 && foundCount == checked) {

        // enable

        button.removeAttr("disabled");

    }

    else {

        // set the disabled attribute

        button.attr("disabled", "true");

    };

}
0

精彩评论

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