!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
<script type="text/javascript" src="jquery.js"></script>
</head>
<style type="text/css">
input{
background:#fff;
}
</style>
<body>
<select class="select">
<option value= "credit" data-id="信贷业务"> credit </option>
<option value= "debt" data-id="融资业务"> debt</option>
<option value= "activity" data-id="营销活动"> activity </option>
</select>
<input class="first" type= "text " id= "text1 " value= "信贷业务" readonly="readonly"/>
<!--<input type= "text " id= "text2 " value= "1 "/>-->
<br /><br /><br />
<select class="select1">
<option value= "workpiece"> workpiece</option>
<!--<option value= "approvalAgreement" data-id="准入审批"> approvalAgreement</option>
<option value= "agreementApproval" data-id="协议审批">agreementApproval</option>
<option value= "projectApproval" data-id="项目审批">projectApproval</option>
<option value= "activityApproval" data-id="活动审批"> activityApproval</option>-->
</select>
<input class="second" type= "text " id= "text11 " value= "手动进件" readonly="readonly"/>
</body>
<script>
$(function(){
$('.select').change(function getInfo(){
var val=$(this).val();
// $('input').eq(0).val($(this).val())
$('.first').val($('option[value='+$(this).val()+']').data('id'));
$('.select1').empty();
switch(val){
case 'credit':
$('.select1').append('<option value= "workpiece" data-id="手动进件"> workpiece</option> ');
$('.select1').append('<option value= "approvalAgreement" data-id="准入审批"> approvalAgreement</option> ' );
$('.second').val('手动进件');
break;
case 'debt':
$('.select1').append('<option value= "agreementApproval" data-id="协议审批">agreementApproval</option> ');
$('.second').val('协议审批');
$('.select1').append('<option value= "projectApproval" data-id="项目审批">projectApproval</option> ' );
break;
case 'activity':
$('.select1').append('<option value= "activityApproval" data-id="活动审批"> activityApproval</option>- ');
$('.second').val('活动审批');
break;
}
})
$('.select1').change(function(){
var val=$(this).val();
// $('#text11').val($('option[value='+$(this).val()+']').data('id'));
// $('#text11').val($('.select1 option[value='+$(this).val()+']').data('id'));
$('.second').val($('option[value='+$(this).val()+']').data('id'));
})
})
</script>
<html>
嵌套级联参考
最新推荐文章于 2023-02-01 17:44:13 发布