Developers Heaven Forum

Web Programming => Java Script => Topic started by: admin on October 19, 2011, 10:47:47 PM

Title: jQuery: How to check if button is disabled
Post by: admin 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>