Refresh issue in removing listitem dynamically from jQuery mobile listview

jquery, jquery-mobile, listview

Solution

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/

Problem

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.

Original source