我的问题很简单,有没有一种方法可以在 JQuery Mobile 中的同一个按钮上添加两个不同的图标?
我试过了
<a class=" clicko ui-btn ui-icon-delete ui-icon-search" href="#foo" id="1">Venta</a>
但它不起作用。其实我想通过JS动态地在按钮中添加一个图标。像这样的东西
<script>
$(document).on('change','[type="radio"]',function(){
$(".me").closest("div").addClass("ui-icon-check");
)};
</script>
所以我尝试使用 JS 添加一个图标。
谁能帮我解决这个问题
提前致谢
最佳答案
工作示例:http://jsfiddle.net/Gajotres/L55J4/
HTML:
<a class=" ui-btn ui-shadow ui-corner-all ui-icon-arrow-l ui-btn-icon-left" href="#foo" id="1">
Venta
<span class="ui-shadow ui-corner-all ui-icon-arrow-r ui-btn-icon-right ui-shadow-custom"></span>
</a>
CSS:
.ui-shadow-custom {
box-shadow: 0 0 0 rgba(0, 0, 0, 0.15) !important;
}
基本上,我在按钮容器内添加了 span 元素,并将其添加到类按钮中,用于在右侧显示图标。原始按钮在左侧有一个图标。另外还需要额外的 CSS 规则来防止内部图标显示幻影。
关于javascript - 是否可以在JQM的按钮中添加两个图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24039816/