How to select all check boxes using jquery in spring form

余生长醉 提交于 2020-01-06 15:18:23

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!