0
我使用icheck.js作为单选按钮和复选框。当我现在使用它们时,它打破了我的表单过去的工作方式。我有一个复选框,当检查它应该显示一个表单,但现在当我检查它没有发生任何事情。 (也许是因为实际的复选框它自身没有被选中)当使用icheck选中复选框时显示表单,js
http://jsfiddle.net/75qmj037/6/
与显示选中该复选框,当我的形式任何帮助将不胜感激!
<div class="row">
<div class="col-lg-12">
<div class="form-group i-checks">
<input type="checkbox" name="anotherSeller1" id="anotherSeller1" onchange="valueChanged1()" />
<em>Check this box if there is another seller.</em>
</div>
</div>
</div>
<div name="Form2" id="Form2" style="display: none;">
test
</div>
JS
jQuery('input').iCheck({
checkboxClass: 'icheckbox_square-blue',
radioClass: 'iradio_square-blue',
increaseArea: '20%' // optional
});
function valueChanged1()
{
if($('#anotherSeller1').is(":checked"))
$("#Form2").show();
else
$("#Form2").hide();
$("#Form2 > .clearfix input:text").val("");
$("#Form2 > select").val("");
$("#anotherSeller2").prop("checked", false);
$("#Form3").hide();
$("#Form3 > .clearfix input:text").val("");
$("#Form3 > select").val("");
$("#anotherSeller3").prop("checked", false);
$("#Form4").hide();
$("#Form4 > .clearfix input:text").val("");
$("#Form4 > select").val("");
$("#anotherSeller4").prop("checked", false);
$("#Form5").hide();
$("#Form5 > .clearfix input:text").val("");
$("#Form5 > select").val("");
}
感谢您的帮助!让我知道如果这将是你可以弄清楚的东西http://stackoverflow.com/questions/41125795/icheck-js-radio-button-automatically-gets-checked-when-tabbing-32-through-form –
可以你告诉我如何做一个特定的功能,我不能让另一个工作,因为功能是奇怪的 –
我不知道你在问什么。您可以将侦听器更改为使用任何JS函数,只要它在作用域中并且在将其添加为处理程序之前存在。 – mherzig