Reputation: 6155
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.
Upvotes: 3
Views: 3355
Reputation: 144689
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://api.jquery.com/category/selectors/
Upvotes: 4