JQuery mobile -Edit Listview和Popup统计气泡

时间:2012-11-24 08:25:09

标签: jquery mobile dynamic count popup

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


<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 ... 谢谢^ _ ^

1 个答案:

答案 0 :(得分:0)

这是您的修改版本 jsfiddle example

你应该做的就是为每个气泡id分配<span>然后使用$( "#popup" ).popup( "open", options);以编程方式打开弹出窗口,点击确定按钮后,用<span>更新id使用$('#id').text(quantity)

的{{1}}