Richard77
Richard77

Reputation: 21631

How to check that a control is disabled no matter the browser?

First of all, I don't know why a disable control is still activating Javascript function. Now, I've added the below lines to check if the control is disabled, then just cancel the operation. IE9 is working, but Chrome and FireFox are not working.

var isDisabled = document.getElementById('contentMain__lnkDelete').getAttribute('disabled');
if (isDisabled == true) {
    return false;
}

Upvotes: 0

Views: 1500

Answers (1)

gdoron
gdoron

Reputation: 150253

Simply:

if (document.getElementById('contentMain__lnkDelete').disabled)
    return false;

Or:

return  !document.getElementById('contentMain__lnkDelete').disabled;

Upvotes: 1

Related Questions