gpt4 book ai didi

jquery mobile、列表、隐藏箭头图标

转载 作者:行者123 更新时间:2023-12-01 05:57:45 24 4
gpt4 key购买 nike

我正在尝试使用 jquery 事件从一个列表项中删除箭头图标。

一个列表项:

<li class='message_list'><a id='message_list_item' href='#'>
<h3>Sender</h3>
<p><strong>Subject</strong></p>
<p>Body Text</p>
<p class='ui-li-aside'><strong>Time</strong>am</p>
</a></li>

脚本:

$(".message_list").swipeleft(function(event) {
event.stopImmediatePropagation(); //prevent from firing twice
$(this).attr('data-icon', 'false');
$("#test_display").html("Worked");

return false;
});

测试 html 更新,因此脚本激活。但为什么这个属性改变不起作用呢?

推杆<li data-icon='false' class='message_list'>但确实删除了它!

最佳答案

data-* 属性通过 data 支持。尝试使用 -

 $(this).data('icon', 'false');

然后您可以使用 -

检查
$(this).data('icon');    // will return false if set to false.

关于jquery mobile、列表、隐藏箭头图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13736492/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com