Author Topic: jQuery: How to check if button is disabled  (Read 8081 times)

Offline admin

  • Administrator
  • Sr. Member
  • *****
  • Posts: 296
    • View Profile
jQuery: How to check if button is disabled
« on: October 19, 2011, 10:47:47 PM »
jQuery: How to check if button is disabled

You can use jQuery to trigger a button click from the client.  In this certain situation, I needed to make sure the button was not disabled prior to clicking.  In jQuery you can use the “is” function to check if the button is disabled like this:
Code: [Select]
<script type="text/javascript">
    $(document).ready(function() {
    if ($('#StartButton').is(':disabled') == false) {
            $('#StartButton').click();
        }
    });
</script>