要实现的效果是选中一级类目或者选中二级类目点确定按钮,能取到所选的值.

确定
$("#a1").click(function(){
var iii = $(this).prev().find("input");
var aaa = '';
$(iii).each(function(){
if( $(iii).prop("checked") == true ){
aaa += $(this).next().text()+',';
}else{
console.log("1")
}
})
console.log(aaa);
})
现在我这个方法就是点击确认按钮 把所有的checkbox后面的值都取到了...
求各位帮忙看看问题出在哪了
Copyright 2014-2026 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
你的循环里的判断条件写错了,是
$(this)不是$(iii)。$("#a1").click(function(){
})