jquery - 从 jQuery 移动 ListView 动态删除列表项时的刷新问题

标签 jquery listview jquery-mobile

我正在使用 jQuery Mobile 创建一个应用程序。我有一个 ListView ,我想从中删除现有项目。但是,我无法动态删除它。

请参阅 jsfiddle 获取我的代码:http://jsfiddle.net/zbNms/11/

我希望动态编辑/删除 ListView 中的列表项。

最佳答案

您使用的是一个属性选择器,它根据元素的属性来选择元素。您应该使用 :contains() 选择器:

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/

关于jquery - 从 jQuery 移动 ListView 动态删除列表项时的刷新问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11658300/

相关文章:

jquery - jsPdf 给 pdf 页面添加边距

Android ListView 返回空值?

android - 如何在ListView中为ImageView设置onClick事件

c# - Xamarin.Forms ListView 更改 Cell on ContextMenu 打开

jquery - CSS 在同一行显示标题和按钮

javascript - jQuery 移动 : Place elements side-by-side/below - Depending on Platform

jquery - Facebook 相似状态更新文本框

javascript - 在 Jquery 中定位图像

jquery - Bootstrap Datepicker 滚动问题

javascript - 更新 ng 类上的特定对象