gpt4 book ai didi

javascript - 在 jQuery Mobile 中更改数据图标?

转载 作者:搜寻专家 更新时间:2023-11-01 04:58:03 24 4
gpt4 key购买 nike

我在网上找到了一堆解决方案,但没有一个适合我。基本上,我想切换按钮的图标。这是 HTML:

  <div data-role="navbar" data-iconpos="top">
<ul>
<li><a data-icon="arrow-u">View suggestions</a></li>
</ul>
</div>

我尝试了所有这些:

$(this).buttonMarkup({ icon: 'arrow-u' });

//

$(this).attr('data-icon','arrow-u');
$(this).children().children().next().removeClass('ui-icon-arrow-d').addClass('ui-icon-arrow-u');

//

$(this).jqmData('icon','arrow-u');

但是,由于某种原因,在运行上述任何一个之后按钮的子元素都消失了(jQuery Mobile 在按钮内添加了一堆 <span> s)。

最佳答案

最好的方法是:

$('#button').buttonMarkup({ icon: "home" });

关于javascript - 在 jQuery Mobile 中更改数据图标?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11606194/

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