用jquery实现多选框

jsp的代码:

jquery部分:

$(function() {
			//全选或全不选
    			$(document).off("click","#authDirectAll").on("click","#authDirectAll",function() {
				if(this.checked) {
					$("#authDirectListTable input[name='authDirectCheckbox']").prop("checked", "checked");
				} else {
					$("#authDirectListTable input[name='authDirectCheckbox']").removeAttr("checked");
				}
			});
			$('#authDirectModeRecord').on('show.bs.modal', function () {
				  selectEvent('${ctx}/myProfile/zgqxxzk/${purDeptArchives.id}','form','authDirectListPannel');
			});	
			
		});

authDirectAll:控制全选的复选框的id

authDirectListTable:显示结果的id,可以是div也可以是tabel

prop:是设置值,removerAttr是移除属性

authDirectModeRecord:是整个弹出框的div的id

show.bs.modal:是对弹出框显示的设置

selectEvent:事件发出了请求,其中的参数分别表示请求的类方法,请求的表单name,返回结果div的id

对于seletEvent时间发出的请求后台的回复是:


	@RequestMapping(value = { "/zgqxxzk/{purDeptArchivesId}" })
	public ModelAndView zgqxxzk(@PathVariable("purDeptArchivesId") String purDeptArchivesId) {
		..........
		ModelAndView model = new ModelAndView("/myProfile/purDepartment/editAuthDirectModeRecord");
		.............
		model.addObject("name",name);//要传的值
		return model;
	}

 

 

你可能感兴趣的:(练习)