//是否被选中验证有选中的设置为true,否设置为false function myCheckbox() { flag += 1; if (flag%2 == 0){ $('#isSelf').attr("checked", "false"); return $('#selectSel').val("true"); } else { $('#isSelf').attr("checked", "true"); return $('#selectSel').val("false"); } }
监听:
$(document).ready(function () { $('#isSelf').attr("checked","checked"); $('#selectSel').val("true"); });