我知道如何在拆分按钮单击时从列表视图中删除列表项,如您在此处看到的: jsfiddle
代码:
$('#produsele').children('li').on('click', function () {
var selected_index = $(this).index();
$(this).closest('li').remove()
//alert('Selected Index = ' + selected_index);
});
但是我希望在弹出窗口询问您是否确定要删除它之后能够做到这一点,就像在这个jsfiddle
这
HTML
<div data-role="page" id="produsele">
<ul id="listaprod" data-role="listview" data-split-icon="delete" data-split-theme="d" data-inset="true">
<li><a href="#">
<img src="images/pic1.jpg" />
<h2>First product</h2>
<p>description</p></a>
<a href="#sterge" data-rel="popup" data-position-to="window" data-transition="pop">Delete</a>
</li>
<li><a href="#">
<img src="images/pic2.jpg" />
<h2>Second product</h2>
<p>other description</p></a>
<a href="#sterge" data-rel="popup" data-position-to="window" data-transition="pop">Delete</a>
</li>
</ul>
<div data-role="popup" id="sterge" data-theme="d" data-overlay-theme="b" class="ui-content" style="max-width:340px; padding-bottom:2em;">
<h3>Delete product?</h3>
<p>Do you want to remove this product from the list?</p>
<input id="delButton" data-inline="true" data-mini="true" data-icon="check" type="button" value="Delete!" />
<input id="giveupButton" data-inline="true" data-mini="true" data-icon="delete" type="button" value="No" />
</div>
</div>
你能帮助我吗?如何<li>
从弹出窗口内部引用主页?