I am creating an app using jQuery Mobile. I have a listview from which i want to remove an existing item. However, I am not able to remove it dynamically.
Please see jsfiddle for my code: http://jsfiddle.net/zbNms/11/
I wish to edit/remove the list item from listview dynamically.
What you are using is an attribute selector which selects the elements based on their attributes. You should use :contains() selector instead:
Select all elements that contain the specified text.
$('#delete').click(function(){
var item2 = $("#mylist").find("li:contains('item2')");
item2.remove();
$("mylist").listview("refresh");
})
http://jsfiddle.net/zbNms/12/
http://api.jquery.com/category/selectors/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With