This is a migrated thread and some comments may be shown as answers.

Change Toggle state with jQuery

1 Answer 95 Views
Button
This is a migrated thread and some comments may be shown as answers.
Richard Boarman
Top achievements
Rank 1
Richard Boarman asked on 15 Mar 2012, 07:58 PM
I need to set the toggle state via jQuery when an item is updated somewhere else on the page.
The class of the radbutton is "theRequiredButton" and the button has an attribute of "data-stepinstanceid" (there are multiple instances of this button on the page, and I use the data attribute to find this instance.
I use this to find the element:
var thebutton = $(".theRequiredButton[data-stepinstanceid='" + args + "']"); where args is the stepinstanceid of this particular button.
How do I now change the button's appearance, in effect, toggling it to the selected/unselected state?
I tried "$(thebutton).set_checked('true');, but this throws an error

1 Answer, 1 is accepted

Sort by
0
Kevin
Top achievements
Rank 2
answered on 16 Mar 2012, 01:14 PM
Hello Richard,

The first problem with your code is that you can't access the RadButton's client object by using the standard jQuery $ method, you need to use the $find method. After that you should be able to change the toggle state by calling this method: set_selectedToggleStateIndex()

I hope that helps.
Tags
Button
Asked by
Richard Boarman
Top achievements
Rank 1
Answers by
Kevin
Top achievements
Rank 2
Share this question
or