Note that there are some explanatory texts on larger screens.

plurals
  1. PORefreshing jQueryMobile styling on radio buttons on the fly
    primarykey
    data
    text
    <p>I'm attempting to re-style a vertical group of radio buttons, and the new theme I add to one of them shows up but the theme I remove from another/the rest doesn't go away.</p> <p>My goal is to change theme of the selected radio button (the related controls, anyway) to make it stand out more when selected.</p> <pre><code>&lt;div data-role="content"&gt; ... &lt;fieldset data-role="controlgroup" id="showChooser"&gt; &lt;legend&gt;&lt;h3&gt;Which show are you attending?&lt;/h3&gt;&lt;/legend&gt; &lt;input type="radio" name="activeShow" id="activeShow1" value="1" /&gt; &lt;label for="activeShow1"&gt; &lt;h2&gt;Choice 1&lt;/h2&gt; &lt;p&gt;03/25/2012 - 03/27/2012&lt;/p&gt; &lt;/label&gt; &lt;input type="radio" name="activeShow" id="activeShow2" value="2" /&gt; &lt;label for="activeShow2"&gt; &lt;h2&gt;Choice 2&lt;/h2&gt; &lt;p&gt;03/25/2012 - 03/27/2012&lt;/p&gt; &lt;/label&gt; &lt;input type="radio" name="activeShow" id="activeShow3" value="3" /&gt; &lt;label for="activeShow3"&gt; &lt;h2&gt;Choice 3&lt;/h2&gt; &lt;p&gt;03/25/2012 - 03/27/2012&lt;/p&gt; &lt;/label&gt; ... &lt;/fieldset&gt; ... &lt;/div&gt; </code></pre> <p>This results in the following list being displayed:</p> <p><a href="http://img.skitch.com/20120319-8wfa4ep6txwdtgjy475k6b5c3k.png" rel="nofollow noreferrer">base state http://img.skitch.com/20120319-8wfa4ep6txwdtgjy475k6b5c3k.png</a></p> <p>So, on-click of one of them, I'm running this code:</p> <pre><code>$('#showChooser input:radio').click(function(e) { $("#showChooser label").attr('data-theme','c'); $(this).next().attr('data-theme','e'); $("#settings").page(); }); </code></pre> <p>The first line should, in theory, reset them all to the base-state of theme 'C', and then the second line would highlight the selected item. I can step through and see that these HTML changes are made, so it's obvious that what needs to happen next is for jQuery Mobile to re-parse and update the display.</p> <p>Note the desperate attempt at refreshing the whole page with <code>.page()</code> at the end -- even that doesn't achieve the desired effect.</p> <p>The first time you click one, it has the desired effect:</p> <p><img src="https://img.skitch.com/20120319-xruayf7t3873ibrh1mcuu8swau.png" alt="state 2"></p> <p>But subsequent clicks don't appear to un-highlight any previously selected rows:</p> <p><img src="https://img.skitch.com/20120319-a1s14jeetn5skrwsfhcfcnyj6.png" alt="state 3"></p> <p>I've also tried <code>$("#showChooser").listview("refresh")</code> and a few other similar things that I can't recall, but none have the desired effect. So what am I missing/doing wrong?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload