隐藏的div和显示div制作单选按钮不工作jQuery移动

时间:2013-06-21 17:43:00

标签: jquery jquery-mobile mobile radio-button refresh

我有一个div在页面加载时隐藏,然后在用户点击按钮时显示。

这个div包含更多打开jQuery移动弹出窗口的按钮。这些弹出窗口上有单选按钮。单选按钮显示,但是当您单击它们时,它们不会切换选中哪一个。任何想法如何解决这一问题?我认为刷新的东西可以做到,但我尝试了一些不同的东西但没有成功。

<div class="ui-grid-b center hide" id="grid-2">
                <div class="ui-block-a gridRows">
                    <h2 class="labelText">LS1</h2>
                    <a href="#LS1popup" data-rel="popup" onClick="strobeBackground();"><img src="images/LEDoff.gif" id="LS1LED" class="LED"></a>
                </div>
                <div class="ui-block-b gridRows">
                    <h2 class="labelText">LS2</h2>
                    <a href="#LS2popup" data-rel="popup" id="" onClick="strobeBackground();"><img src="images/LEDoff.gif" id="LS2LED" class="LED"></a>
                </div>
                <div class="ui-block-c gridRows">
                    <h2 class="labelText">MS</h2>
                    <a href="#MSpopup" data-rel="popup" id="" onClick="strobeBackground();"><img src="images/LEDoff.gif" id="MSLED" class="LED"></a>
                </div>
            </div>

下面这个div有弹出按钮和单选按钮

<div data-role="popup" id="LS1popup" data-theme="d">
            <a href="#" data-rel="back" data-role="button" data-theme="b" data-icon="delete" data-iconpos="notext" class="ui-btn-right">Close</a>               
                <fieldset data-role="controlgroup" data-inset="true">
                    <ul data-role="listview" data-inset="true" data-theme="d" data-icon="">
                      <li>Edit LS1 LED</li>
                    </ul>
                      <input type="radio" name="LS1" id="LS1off" value="off" onClick="setImages();" data-theme="b" checked="checked"/>
                      <label for="LS1off">Off</label>
                      <input type="radio" name="LS1" id="LS1green" value=" green" onClick="setImages();" data-theme="b"/>
                      <label for="LS1green">Green</label>
                      <input type="radio" name="LS1" id="LS1flashinggreen" value="flashinggreen" onClick="setImages();"  data-theme="b"/>
                      <label for="LS1flashinggreen">Flashing Green</label>
                      <input type="radio" name="LS1" id="LS1yellow" value="yellow" onClick="setImages();"  data-theme="b"/>
                      <label for="LS1yellow">Yellow</label>
                </fieldset>
        </div><!-- /popup -->

2 个答案:

答案 0 :(得分:0)

在这里工作正常http://jsfiddle.net/yeyene/AeXnV/点击LS1下的图片并查看。

setImages()函数正在做什么?

<div data-role="popup" id="LS1popup" data-theme="d">
        <a href="#" data-rel="back" data-role="button" data-theme="b" data-icon="delete" data-iconpos="notext" class="ui-btn-right">Close</a>               
            <fieldset data-role="controlgroup" data-inset="true">
                <ul data-role="listview" data-inset="true" data-theme="d" data-icon="">
                  <li>Edit LS1 LED</li>
                </ul>
                  <input type="radio" name="LS1" id="LS1off" value="off" onClick="setImages();" data-theme="b" checked="checked"/>
                  <label for="LS1off">Off</label>
                  <input type="radio" name="LS1" id="LS1green" value=" green" onClick="setImages();" data-theme="b"/>
                  <label for="LS1green">Green</label>
                  <input type="radio" name="LS1" id="LS1flashinggreen" value="flashinggreen" onClick="setImages();"  data-theme="b"/>
                  <label for="LS1flashinggreen">Flashing Green</label>
                  <input type="radio" name="LS1" id="LS1yellow" value="yellow" onClick="setImages();"  data-theme="b"/>
                  <label for="LS1yellow">Yellow</label>
            </fieldset>
    </div><!-- /popup -->

答案 1 :(得分:0)

想出来,我找到了正确的单选按钮刷新jQuery

http://jquerymobile.com/demos/1.0/docs/forms/docs-forms.html