您的位置:首页 > Web前端 > JavaScript

js里面如何才能让成员方法去调用类中其他成员方法

2017-04-21 10:38 429 查看
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();
})
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: