jQuery mobile 图标

定位图标
请使用 data-iconpos 属性来规定位置
<a href="#link" data-role="button" data-icon="search" data-iconpos="top">上</a>
<a href="#link" data-role="button" data-icon="search" data-iconpos="right">右</a>
<a href="#link" data-role="button" data-icon="search" data-iconpos="bottom">下</a>
<a href="#link" data-role="button" data-icon="search" data-iconpos="left">左</a>

只显示图标
如果只需显示图标,请将 data-iconpos 设置为 "notext":

<a href="#link" data-role="button" data-icon="search" data-iconpos="notext">搜索</a>

 

jQuery mobile prop 用法

赋值时候

如果是<input type="checkbox" checked>这样的只有属性名就能生效的属性
推荐prop,即:$(‘input‘).prop(‘checked‘,true);
同时,false表示取消,即:$(‘input‘).prop(‘checked‘,false);
当然attr也行的:$(‘input‘).attr(‘checked‘,‘这里写什么都行的‘);
取消属性就是移除:$(‘input‘).removeAttr(‘checked‘);

取值的时候

如果是<input  id="input1" type="checkbox" checked><input  id="input2" type="checkbox">
推荐使用prop,即:
$(‘#input1‘).prop(‘checked‘); //返回true
$(‘#input2‘).prop(‘checked‘); //返回false
而使用attr,则:
$(‘#input1‘).attr(‘checked‘); //返回checked
$(‘#input2‘).attr(‘checked‘); //返回undefined

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。