Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jsf-2/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 选中所有复选框时启用p:commandlink按钮_Jquery_Jsf 2 - Fatal编程技术网

Jquery 选中所有复选框时启用p:commandlink按钮

Jquery 选中所有复选框时启用p:commandlink按钮,jquery,jsf-2,Jquery,Jsf 2,在我的页面中,我有三个复选框,我想在选中所有复选框时启用提交按钮 <input type="checkbox" class="check" id="check1" /> <input type="checkbox" class="check" id="check2" /> <p:commandLink id="reviewLink" update="messages" ajax="false" action="${reviewBean.approveAndSubm

在我的页面中,我有三个复选框,我想在选中所有复选框时启用提交按钮

<input type="checkbox" class="check" id="check1" />
<input type="checkbox" class="check" id="check2" />

<p:commandLink id="reviewLink" update="messages" ajax="false" action="${reviewBean.approveAndSubmitWorkflow}"   value="#msg['review.label.button.approve.submit']}"></p:commandLink>

您可以执行以下操作:

$("input.check").change(function(){
    if ($('input.check:checked').length == $('input.check').length) {
       $('#reviewLink').prop('disabled' , false);
    }
});
**

这很简单

**


//禁用提交按钮
$(“#提交按钮”).attr('disabled','disabled');
//处理事件
$(“#check1,#check2,#check3”).live(“change”,function(){
//核对
如果($('check1')。是(':选中的')&&('check2')。是(':选中的')&('check3')。是(':选中的')){
$(“#提交按钮”).removeAttr('disabled');
}
})

命令链接的等效HTML是什么?
if($( "input:checked").length==3){    
  $('#reviewLink').prop('disabled',false);
}
    <input type="checkbox" class="check" id="check1" />
    <input type="checkbox" class="check" id="check2" />
    <input type="checkbox" class="check" id="check3" />
    <script>
    // Disable submit button
    $("#submitButton").attr('disabled','disabled');

    // Handle event
$("#check1, #check2, #check3").live("change",function(){
 // Make a check
    if ($('#check1').is(':checked') && $('#check2').is(':checked') && $('#check3').is(':checked')){
    $("#submitButton").removeAttr('disabled');
    }
})

    </script>