DHHD-单选按钮,同时将码表和对应的值都传到后端

<tr>
								<td class="tdCenter w13p"><span class="requiredMark">*</span>假 别</td>
								<td class="tdLeft w87p" colspan="3">
									<div class="radio-inline">
										<input type="hidden" id="leaveType" name='leaveType'> 
										<div class="radioDiv">
											<input type="radio" id="radio10" name='leaveTypeCode' value="10" checked="true"> 
											<label for="radio10"> <span class="radioSpan">事假 </span></label>
										</div>
										<div class="radioDiv">
											<input type="radio" id="radio11" name='leaveTypeCode' value="11">
											<label for="radio11"> <span class="radioSpan">产假</span></label>
										</div>
										<div class="radioDiv">
											<input type="radio" id="radio12" name='leaveTypeCode' value="12">
											<label for="radio12"> <span class="radioSpan">婚假</span></label>
										</div>
										<div class="radioDiv">
											<input type="radio" id="radio13" name='leaveTypeCode' value="13">
											<label for="radio13"> <span class="radioSpan">丧假</span></label>
										</div>
										<div class="radioDiv">
											<input type="radio" id="radio14" name='leaveTypeCode' value="14">
											<label for="radio14"> <span class="radioSpan">休假</span></label>
										</div>
										<div class="radioDiv">
											<input type="radio" id="radio15" name='leaveTypeCode' value="15">
											<label for="radio15"> <span class="radioSpan">探亲假</span></label>
										</div>
									</div>
								</td>

							</tr>

js

$(function(){//页面加载完执行函数
	setPersonAndDept();
	if(leaveId != ""){
		initEditForm();//填充表单
	}
	if(isRejet == ""){
		createButton();//创建编辑页面按钮
	}else{
		createRejetButotn();
	}
	validateDetail();//表单验证
	bindEvent();
});

function bindEvent(){
	// 更改假别事件
	$("input[name='leaveTypeCode']").change(function() {
	var leaveType = $("input[name='leaveTypeCode']:checked").next().text();//取对应的text值
	$("#leaveType").val(leaveType);
	})
}

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章