Nilesh
Nilesh

Reputation: 6155

Refresh issue in removing listitem dynamically from jQuery mobile listview

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

Answers (1)

Ram
Ram

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://jsfiddle.net/zbNms/12/

http://api.jquery.com/category/selectors/

Upvotes: 4

Related Questions