How to set jQuery UI toggle programmatically?

Posted by bebraw on Stack Overflow See other posts from Stack Overflow or by bebraw
Published on 2010-04-11T16:20:37Z Indexed on 2010/04/11 16:23 UTC
Read the original article Hit count: 320

Filed under:
|
|

I noticed it is possible to set the value of a jQuery UI slider in the following way:

$("#mySlider").slider("value", 42);

This triggers the event handlers attached to the slider as expected.

Now I'm trying to do the same trick using a button (toggle). There does not appear to be a nice way to do this in the API. I might just be missing something simple.

I tried the following with no results:

$("#myButton").button().click();

Any ideas how to handle that in this case are welcome. Note that it would be awesome to find a solution that applies for a buttonset as well.

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-ui