jqueryjquery-uijquery-ui-button

How to show disabled state for a jqueryui button?


I am using Jquery UI buttons (http://jqueryui.com/demos/button/). I would like to know how I can show a disabled state. Show the button as greyed out or something, you know how when you post a form on some sites the submit button shows as disabled.

Also is there anyway to display an active state???

This is my code:

 $(".commentsbutton").button({icons: { primary: 'ui-icon-comment'}}); 

<a href="javascript:void[0]">Comments</a>

Solution

  • You can disable the button via the disable method, like this:

    $(".commentsbutton").button("disable");​​​​​​​​​​​​​
    

    You can give it a try here, to re-enable later, just use the enable method, like this:

    $(".commentsbutton").button("enable");​​​​​​​​​​​​​