3

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


<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 实现它...谢谢之前 ^_^

4

1 回答 1

0

这是您的 jsfiddle 示例的修改版本

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

于 2015-04-09T02:00:52.597 回答