【问题标题】:JQuery mobile -Edit Listview and count bubbles with PopupJQuery mobile - 使用 Popup 编辑 Listview 和计数气泡
【发布时间】:2012-11-12 10:31:06
【问题描述】:

我想制作一个列表,里面有 Count Bubbles, 但计数气泡是动态的, 所以我的意思是当单击列表时,会显示弹出窗口并询问值,如果我们输入值并单击“确定”按钮,计数气泡的值会自动更改.... 这是代码


<ul id="list" data-role="listview"  data-inset="true"  data-theme="e" data-divider-theme="b">

<li data-filtertext="ayam, goreng"><a href="#popupQTY" data-rel="popup" data-position-to="window" data-inline="true" data-transition="flow">List 1 <span class='ui-li-count'>1</span></a> </li>
<li data-filtertext="ayam, penyet"><a href="#popupQTY" data-rel="popup" data-position-to="window" data-inline="true" data-transition="flow">List 2 <span class='ui-li-count'>2</span></a></li>
<li data-filtertext="ayam, bakar" ><a href="#popupQTY" data-rel="popup" data-position-to="window" data-inline="true" data-transition="flow">List 3 <span class='ui-li-count'>3</span></a></li>
<li data-filtertext="ayam, guling"><a href="#popupQTY" data-rel="popup" data-position-to="window" data-inline="true" data-transition="flow">List 4 <span class='ui-li-count'>4</span></a></li>  


这是弹出窗口

div data-role="popup" id="popupQTY" data-theme="a" class="ui-corner-all">

    <a href="#" data-rel="back" data-role="button" data-theme="a" data-icon="delete" data-iconpos="notext" class="ui-btn-right">Close</a>           

        <form>
            <div style="padding:10px 20px;">
              <h3>Please input the Quantity</h3>
              <label for="un" class="ui-hidden-accessible">Qty :</label>
              <input type="number" name="qty" id="QTY" value="1" placeholder="qty" data-theme="a" />

              <a href="#" id="setQty" data-role="button" data-theme="b" data-transition="flow">Ok</a>
            </div>
        </form>
    </div>

http://jsfiddle.net/idam/mAdDN/


帮助我如何使用 JavaScript 代码或 JQuery... 之前谢谢^_^

【问题讨论】:

    标签: jquery mobile dynamic count popup


    【解决方案1】:

    这是您的修改版本 jsfiddle example

    基本上你应该做的是将id 分配给每个气泡&lt;span&gt;,然后使用$( "#popup" ).popup( "open", options); 以编程方式打开弹出窗口,当单击确定按钮时,使用$('#id').text(quantity)&lt;span&gt; 更新为id

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-10-22
      • 2012-06-04
      • 1970-01-01
      • 2023-03-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多