jquery - Remove a li from listview on splitbutton click with popup -
i know how remove list item listview on split-button click can see here: jsfiddle
code:
$('#produsele').children('li').on('click', function () { var selected_index = $(this).index(); $(this).closest('li').remove() //alert('selected index = ' + selected_index); });
but want able after popup asks if sure want delete it, in jsfiddle
the
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 want remove product 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>
can me? how reference <li>
main page, inside popup?
something should work
var li = ''; $(document.body).on('click', '.del' ,function(){ li= $(this).parent(); $('#sterge').popup("open"); }); $(document.body).on('click', '#delbutton' ,function(){ $('#sterge').popup("close"); li.remove(); }); $(document.body).on('click', '#giveupbutton' ,function(){ $('#sterge').popup("close"); });
Comments
Post a Comment