首页 > Web开发 > 详细

Jquery mobile中的 checkbox和radio的设置问题

时间:2017-06-20 19:06:31      阅读:323      评论:0      收藏:0      [点我收藏+]

在Jquery Mobile网页中用JS控制Radio的状态一直达不到目的。

用$("input[name=‘radio‘]:first").prop("checked",true)设置checked的时候,用.attr("checked")读取不到值。

用$("input[name=‘radio‘]:first").attr("checked",true)设置checked的时候,页面显示状态变为两个都不显示。

最后只能把prop和attr都写在里面,才算解决了问题。

当然最后的refresh也是必须的,否则也不更新状态。

$("input[name=‘radio‘]:first").prop("checked",true).checkboxradio(‘refresh‘);
$("input[name=‘radio‘]:first").attr("checked",true).checkboxradio(‘refresh‘);
$("input[name=‘radio‘]:last").attr("checked",false).checkboxradio(‘refresh‘);
$("input[name=‘radio‘]:last").prop("checked",false).checkboxradio(‘refresh‘);

Jquery mobile中的 checkbox和radio的设置问题

原文:http://www.cnblogs.com/billybobby/p/7055715.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!