【发布时间】:2015-05-20 11:06:24
【问题描述】:
我使用iCheck 创建现代单选按钮,有四个选项。当用户更改单选按钮时,我会弹出一条确认消息“您确定吗?”
如果确认返回false,我想返回上一个单选按钮,但现在它不返回上一个单选按钮。
这是代码的一部分:
<form action="#" method="post">
<div style="padding-left:20px; line-height:2;">
<input type="radio" id="main-category1" name="main-category" value="1" > 1. <br>
<input type="radio" id="main-category2" name="main-category" value="2" > 2. <br>
<input type="radio" id="main-category3" name="main-category" value="3" > 3. <br>
<input type="radio" id="main-category4" name="main-category" value="4" > 4. <br>
<input type="radio" id="main-category5" name="main-category" value="5" > 5. <br>
</div>
</form>
<scirpt>
$('input').on('ifClicked', function(event){
msg = confirm('Are you sure?');
var cual= this;
if(msg == false) {
$('#main-category3').iCheck('check'); // It's check to new value and check to 3rd radio, but I want to check only 3rd radio.
}
});
</script>
【问题讨论】:
-
如果添加
return false会怎样? -
@JamesDonnelly; add return false --> 没有发生
标签: javascript jquery icheck