Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 504
Nilesh Avatar asked Feb 11 '26 15:02

Nilesh


1 Answers

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/

like image 61
undefined Avatar answered Feb 13 '26 11:02

undefined



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!