解决办法:
实现代码如下:

$('input[type="checkbox"]').bind('click',function() {
$(this).prop('checked').checkboxradio("refresh"); // 绑定事件及时更新checkbox的checked值
});

如果要用js去改变checkbox的值时也要及时刷新。
实现代码如下:

$('input [type="checkbox"]').attr('checked',false).checkboxradio("refresh");
$('input [type="checkbox"]').attr('checked',false).checkboxradio("refresh");

原因: 因为手动改变它的值后,jquerymobile不能重新渲染。 这样页面显示的值和实际值就不一样了。 (jquerymobile 把form表单元素都隐藏起来,然后用 js添加了一些元素易于美化input, select ,textarea 等元素的效果)

以上就是【jquerymobile checkbox及时刷新才能获取其准确值】的全部内容了,欢迎留言评论进行交流!

赞(0) 踩(0)
发表我的评论

最新评论

  1. 暂无评论