如何根据checkbox的值进行勾选!例:我要勾选value等于scanbuy,terminal的复选框!
微商城 随手购 自助购
<div class="controls" id="client"> <input id="mall" type="checkbox" name="client" value="mall">微商城 <input id="scanbuy" type="checkbox" name="client" value="scanbuy">随手购 <input id="terminal" type="checkbox" name="client" value="terminal">自助购 </div>
var inputclients = $("#client input[name='client']");
var clients = “
”
for (var i = 0; i < inputclients.length; i++) {
for (var j = 0; j < clients.length; j++) {
if (inputclients[i].value == clients[j]) {
inputclients[i].checked = true;
}
}
}
效果图如下