我正在try 取消选中jQuery中的输入复选框时,我点击了模式框的No按钮,并选中了它,我点击了Yes按钮.
$('body').off('change', '[name="techOptions"][value="8"]').on('change', '[name="techOptions"][value="8"]', function() {
if ($(this).is(':checked')) {
var $n = noty({
text: 'Please provide relevant complementary information about .....',
modal: true,
layout: 'center',
type: 'neutral',
buttons: [{
addClass: 'btn btn-default',
text: 'Ok',
onClick: function($noty) {
$(this).prop("checked","checked");
$noty.close();
}
},
{
addClass: 'btn btn-default',
text: 'No',
onClick: function ($noty) {
$(this).removeAttr('checked');
$noty.close();
}
}]
});
// Focus on "OK" button
$n.$buttons.find('#button-0').first().focus();
return false;
}
});
在开发人员工具中,我可以看到当点击是时,勾选被添加(勾选="勾选"),当点击否时,勾选标记被隐藏,但在UI中勾选标记没有更新.
我试了$(this).prop("checked","checked");
和$(this).prop("checked",true);
还有$(this).attr("checked",true);
在是按钮中,但没有成功.