Answers
可以使用jquery.multiSelect插件。
需要在页面中引入这些文件,jquery.js,jquery.bgiframe.min.js,jquery.multiSelect.js,jquery.multiSelect.css
<select id="roleIds" name="roleIds" style="width:180px" multiple="multiple">
<c:forEach items="${roleList }" var="role">
<option value="${role.id }">${role.name }</option>
</c:forEach>
</select>
$(document).ready( function() {
$("#roleIds").multiSelect({
selectAll: false,
oneOrMoreSelected: '*',
selectAllText: '全选',
noneSelected: '请选择'
}, function(){ //回调函数
if($("[name='roleIds']:checked").length > 0)
{
$("#errRed").empty();
}
else
{
$("#errRed").text("请选择");
}
});
});
http://www.erichynds.com/examples/jquery-ui-multiselect-widget/demos/
我是李宇春他哥
answered 12 years, 9 months ago