Link to home
Start Free TrialLog in
Avatar of PratikShah111
PratikShah111

asked on

javascript to check button property

In my javascript I want to check if a button is enabled or disabled. how can i do that.
ASKER CERTIFIED SOLUTION
Avatar of PratikShah111
PratikShah111

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Julian Hansen
Why not just check the disabled property on the button
<button id="buttonId' disabled>Disabled Button</button>
<script>
var btn = document.getElementById('buttonId');
if (btn.disabled) {
   alert('Button is disabled');
} else {
   alert('Button is NOT disabled');
}
</script>

Open in new window