我需要根据复选框“继续”。
HTML:
<input type = "text" id = "E1" /><input type="checkbox" id="C1">
<input type = "text" id = "E2" /><input type="checkbox" id="C2">
<input type = "text" id = "E3" /><input type="checkbox" id="C3">
<input type = "text" id = "E4" /><input type="checkbox" id="C4">
JS:
for (var i=1; i<=4; i++) {
if ("$C" +i.checked == true) {continue;}
...;
}
</script>
continue
是用于实现此目的的正确关键字。我怀疑您的情况的问题在于该if
陈述永远不会正确。
我想你想要这个:
// Add 1 to index first and then concatenate with "#C" to create jQuery id selector
if ($('#C' + (i + 1)).is(':checked')) { continue; }
您if
上面的语句在功能上等效(选中时):
if ("$Ctrue" == true) { continue; }
$C和布尔值的字符串值连接在一起。
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句