问题
This is the spring form, how to select all the checkboxes using jquery?
<form:form name="form" method="POST" commandName="da">
<table cellspacing="7">
<tr>
<td>Increment DA by:</td>
<td><form:input path="da" id="da"/></td>
</tr>
<tr>
<td>
<form:checkboxes items="${empids}" path="empids" delimiter="<br/>" id="empids"/>
</td>
</tr>
<tr>
<td colspan="2"><input type="submit" value="Save" ></td>
</tr>
</table>
</form:form>
回答1:
give a common class to all checkboxes and then try this...
$('.commonClass').attr('checked',true);
来源:https://stackoverflow.com/questions/6120552/how-to-select-all-check-boxes-using-jquery-in-spring-form