jquery中input框val值 点击当前val框,其他禁用val并清空,

<div class="layui-form-item">
					<div class="layui-inline">
						<p class="ag_guzhu"><i style="color: red;">*</i> 雇主报价</p>
						<label class="ag_gu_label">
								<div class="layui-input-block">
										<input type="radio" name="sex" value="1" title="按咨询服务费">
								</div>
								<div class="layui-input-inline ag_gu_one">
										<input type="tel" name="text" id="first" value=""  autocomplete="off" class="layui-input">
								</div>
								<label class="layui-form-label ag_yuan">元</label>
						</label>
	 				</div>
				</div>

				<div class="layui-form-item">	
					<label class="ag_gu_label">
							<div class="layui-input-block">
									<input type="radio" name="sex"  value="2" title="按当地政府收费标准的下浮:">
							</div>
							<div class="layui-input-inline ag_gu_one">
									<input type="number" name="text"  id="second" autocomplete="off" class="layui-input">
							</div>
							<label class="layui-form-label ag_yuan" >%</label>
							<label class="layui-form-label ag_gu_two">预估咨询服务费:</label>
							<div class="layui-input-inline ag_gu_two">
							  <input type="text" name="text"  id="second1"  autocomplete="off" value='' disabled class="layui-input">
							</div>
							<label class="layui-form-label ag_yuan" >元</label>
					</label>
						
				</div>
				<div class="layui-form-item">
					<label class="ag_gu_label">
							<div class="layui-input-block">
									<input type="radio" name="sex" value="3" title="按总造价计费:">
							</div>
							<div class="layui-input-inline ag_gu_one">
									<input type="number" name="text"  id="third" autocomplete="off" class="layui-input">
							</div>
							<label class="layui-form-label ag_yuan" >%</label>
							<label class="layui-form-label ag_gu_two" style="margin-left:85px;">预估咨询服务费:</label>
							<div class="layui-input-inline ag_gu_two">
							  <input type="text" name="text"  id="third1"  autocomplete="off" value="" disabled class="layui-input">
							</div>
							<label class="layui-form-label ag_yuan" >元</label>
					</label>					
				</div>
<script src="../js/jquery-1.11.3.min.js" type="text/javascript"></script>


<script>
	//单选
	$("input:radio[name='sex']").each(function () {
		$("input:radio[name='sex']").click(function(){
			let ad_cty = $(this).val();
			if(ad_cty == 1){
				$("#first").attr("disabled", false);
				$("#second").attr("disabled", true);
				$("#second").val('');
				$("#third").val('');
				$("#third").attr("disabled", true);	
			}
			if(ad_cty == 2){
				$("#first").val('');
				$("#third").val('')
				$("#first").attr("disabled", true);
				$("#second").attr("disabled", false);
				$("#third").attr("disabled", true);
			}
			if(ad_cty == 3){
				$("#first").val('');
				$("#second").val('')
				$("#first").attr("disabled", true);
				$("#second").attr("disabled", true);
				$("#third").attr("disabled", false);
			}
            //  console.log(ad_cty);
		});
  
});
</script>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值