Change Toggle state with jQuery

2 posts, 0 answers
  1. Richard Boarman
    Richard Boarman avatar
    23 posts
    Member since:
    Nov 2005

    Posted 15 Mar 2012 Link to this post

    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
  2. Kevin
    Kevin avatar
    360 posts
    Member since:
    Jul 2012

    Posted 16 Mar 2012 Link to this post

    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.
Back to Top