function checkOneOrAllByClass(area){
var $allTar=$("#"+area).find(".checkAll").eq(0);
var $onesTar=$("#"+area).find(".checkOne");
this.clickAll=function () {
if($allTar.is(':checked')){
$onesTar.prop("checked", true);
}else{
$onesTar.prop("checked", false);
}
}
this.clickOne=function () {
var isV = true;
$onesTar.each(function () {
if (!$(this).is(':checked')) {
isV = false;
$allTar.prop("checked", false);
return false;
}
})
if (isV) {
$allTar.prop("checked", true);
}
}
}
$("#lenderEnterprise").on("click", ".checkAll", function () {
new checkOneOrAllByClass('lenderEnterprise').clickAll();
})
$("#lenderEnterprise").on("click", ".checkOne", function () {
new checkOneOrAllByClass('lenderEnterprise').clickOne();
})