Javascript 仅当2个字段的值为1并选中时,才尝试禁用窗体的div部分

Javascript 仅当2个字段的值为1并选中时,才尝试禁用窗体的div部分,javascript,jquery,html,css,forms,Javascript,Jquery,Html,Css,Forms,如果某个表单的某个部分已由主管使用2个字段签名,我将尝试禁用该部分。 问题是它工作得太好了。它禁用新窗体上的节。为了简洁起见,这里有两个字段,这些字段的隐藏值和jquery脚本 这是添加新表单或记录时字段的代码。 这两种形式都在id为superssection的div中。 这是两个字段的html 首先是表单中字段的隐藏值,然后是字段本身的html <div id="supersection" style="border: none;"> <input type="hidden

如果某个表单的某个部分已由主管使用2个字段签名,我将尝试禁用该部分。 问题是它工作得太好了。它禁用新窗体上的节。为了简洁起见,这里有两个字段,这些字段的隐藏值和jquery脚本

这是添加新表单或记录时字段的代码。 这两种形式都在id为superssection的div中。 这是两个字段的html 首先是表单中字段的隐藏值,然后是字段本身的html

<div id="supersection" style="border: none;">

<input type="hidden" name="supersignoff" value="0"/>
<input type="hidden" name="superdeclare" value="0"/>

<label class="padd2left" for="supersignoff">
<input type="checkbox" value="1" id="supersignoff" name="supersignoff" />    
Complete and sign</label>

<label for="superdeclare">
<input type="checkbox" value="1" id="superdeclare" name="superdeclare"  />
I have completed with the best info from all parties</label>
即使是新表单,该部分也会再次被禁用。
有什么想法吗

$(function(){
   var signoff = $("#supersignoff").prop('checked');
   var sdeclare = $("#superdeclare").prop('checked')
   if(signoff && sdeclare){
      $("#supersection *").prop("disabled",true);
  }
});
.prop('checked')将为您提供复选框是否选中的状态,但不是
.val()

参考:和

$(function(){
   var signoff = $("#supersignoff").prop('checked');
   var sdeclare = $("#superdeclare").prop('checked')
   if(signoff && sdeclare){
      $("#supersection *").prop("disabled",true);
  }
});