js 获取所有被选中复选框的值
程序员文章站
2022-04-05 18:33:35
...
注:所有复选框必须name 相同
<tr>
<td>
<input type="checkbox" checked="checked" id="checkAllworkshopOverview"
name="checkWorkshopOverviewItem" value="ck_overview">
车间总览
</td>
<td>
<div class="group-item">
<input type="checkbox" checked="checked" name="checkWorkshopOverviewItem"
value="presentStatusDetail">
<span class="priv" id="company-index">
当前状态详情
</span>
</div>
<div class="group-item">
<input type="checkbox" checked="checked" name="checkWorkshopOverviewItem"
value="historyStatusBut">
<span class="priv" id="company-browse">
历史状态详情
</span>
</div>
<div class="group-item">
<input type="checkbox" checked="checked" name="checkWorkshopOverviewItem"
value="historyQualityBut">
<span class="priv" id="company-browse">
历史质量详情
</span>
</div>
</td>
</tr>
var strgetSelectValue;
var getSelectValueMenbers = $("input[name='checkWorkshopOverviewItem']:checked").each(function(j) {
if (j >= 0) {
strgetSelectValue += $(this).val() + ","
}
});