pradeep
pradeep

Reputation: 1057

How to Disable image button

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

How to disable this button?

Upvotes: 1

Views: 8608

Answers (2)

Phil Helix
Phil Helix

Reputation: 3733

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");

    };

}

Upvotes: 0

Greg
Greg

Reputation: 321844

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.

Upvotes: 3

Related Questions