Jquery mobile 单击第一次单击后未触发的事件
使用jquerymobile 1.4.5 我有一系列单选按钮Jquery mobile 单击第一次单击后未触发的事件,jquery-mobile,Jquery Mobile,使用jquerymobile 1.4.5 我有一系列单选按钮 <fieldset data-role="controlgroup" data-type="horizontal"> <legend>Condition (handles etc.):</legend> <input name="radio-choice-h-28" id="radio-choice-h-28a" value="1" ty
<fieldset data-role="controlgroup" data-type="horizontal">
<legend>Condition (handles etc.):</legend>
<input name="radio-choice-h-28" id="radio-choice-h-28a" value="1" type="radio">
<label for="radio-choice-h-28a">Satisfactory</label>
<input name="radio-choice-h-28" id="radio-choice-h-28b" value="2" type="radio">
<label for="radio-choice-h-28b">Unsatisfactory</label>
<input name="radio-choice-h-28" id="radio-choice-h-28c" value="0" type="radio">
<label for="radio-choice-h-28c">Not Applicable</label>
</fieldset>
条件(手柄等):
满意的
不尽人意
不适用
还有两个按钮
<form>
<input id="set" data-inline="true" value="Save" type="button">
<input id="reset" data-inline="true" value="Reset" type="button">
</form>
事件附加在文档准备区域中
<script type="text/javascript">
$(document).ready(function () {
$("#set").click(function() {
$('#radio-choice-h-28a').attr("checked", true).checkboxradio("refresh");
$("input[type='radio']").checkboxradio("refresh");
$('#radio-choice-h-28a').checkboxradio("refresh");
});
$("#reset").click(function () {
$("input[type='radio']").attr("checked", false).checkboxradio("refresh");
$("input[type='radio']").checkboxradio("refresh");
});
});
</script>
$(文档).ready(函数(){
$(“#设置”)。单击(函数(){
$('#radio-choice-h-28a').attr(“选中”,为真)。checkboxradio(“刷新”);
$(“输入[type='radio'])。复选框radio(“刷新”);
$(“#radio-choice-h-28a”).checkboxradio(“刷新”);
});
$(“#重置”)。单击(函数(){
$(“input[type='radio']”)。attr(“checked”,false)。checkboxradio(“refresh”);
$(“输入[type='radio'])。复选框radio(“刷新”);
});
});
我可以在第一次通过设置收音机的值,并在第一次通过重置所有单选按钮
当我第二次单击“设置”按钮时,什么也没有发生。
在第一次单击后,重置的第二次单击也不会触发
firebug不会显示任何错误消息,但每次单击按钮(设置和重置)时都会命中断点
我缺少什么?尝试使用
$(document).on('click', "#set", function(){
});
而不是
$("#set").click(function() { });
找到了
我把attr改为prop,现在它工作了
$("#radio-choice-h-28a").prop("checked", true).checkboxradio("refresh");
我按要求把它换了。。。同样的结果,点击事件被看到,但没有发生任何事情对不起,误解了您的问题。为什么要使用刷新?