Jquery 选择数组中存在值的所有复选框
我在一个div中有一组复选框。下面是一个示例:Jquery 选择数组中存在值的所有复选框,jquery,Jquery,我在一个div中有一组复选框。下面是一个示例: <input id="customer426693" name="customers" type="checkbox" class="filled-in form-check-input customerCheckbox customerRequired" value="426693"> 我的javascript函数中还有一个要选择的值数组。是否有一种优雅的方法可以使用jquery选择数组中存在值的所有复选框 谢谢。这就是你想要的吗
<input id="customer426693" name="customers" type="checkbox" class="filled-in form-check-input customerCheckbox customerRequired" value="426693">
我的javascript函数中还有一个要选择的值数组。是否有一种优雅的方法可以使用jquery选择数组中存在值的所有复选框
谢谢。这就是你想要的吗
var selectedList=[3,4,6];
函数MakeSelected{
$checkBoxContainer.findinput.eachfunctionindex,项{
如果$item.datacustomerid>=0,则选择了List.indexOf$item.datacustomerid>=0
$item.propchecked,true;
};
}
我删除了类以使其更具可读性。
1.
2.
3.
4.
5.
6.
试试看!给我们看看你的代码。你的意思是检查值了吗?谢谢,很好。