How to check radio box not in view
Hi. I am having a problem selecting a radio button in a web app. My app is a multi page setup, and the first two pages contain a single list of radio buttons. When the app loads, I want to select one of the radio buttons on each page programatically. I am able to select the radio button on the first page, but selecting radio buttons on subsequent pages cause the app to hang. Here is my code - stripped of unnecessary bits.
- <head>
- <script>
- $( document ).bind( "pageinit", function( event, data ){
- $('#'ukLanguage').attr('checked', true).checkboxradio("refresh");
- $('#ukLocation').attr('checked', true).checkboxradio("refresh");
- });
- </script>
- </head>
- <body>
- <div data-role="page" id="setlanguage">
- <section data-role="content">
- <div data-role="fieldcontain">
- <fieldset data-role="controlgroup" data-type="vertical" >
- <input name="languageRadio" id="ukLanguage" type="radio" value="en" />
- <label for="ukLanguage">English</label>
- <input name="languageRadio" id="deLanguage" type="radio" value="de" />
- <label for="deLanguage">German</label>
- </fieldset>
- </div>
- </section>
- </div>
- <div data-role="page" id="setLocation">
- <section data-role="content">
- <div data-role="fieldcontain">
- <fieldset data-role="controlgroup" data-type="vertical" >
- <input name="locationRadio" id="ukLocation" type="radio" value="uk" />
- <label for="ukLocation">United Kingdom</label>
- <input name="locationRadio" id="deLocation" type="radio" value="de" />
- <label for="deLocation">Germany</label>
- </fieldset>
- </div>
- </section>
- </div>
- </body>
I think the second set of radio buttons is already in the DOM, so am not sure why this would not work. Can anyone shed some light on the subject?