jquery怎么把一个select的值 赋给另一个select的值
1个回答
展开全部
$(function(){
function _spansel(select,span){
var selectedoptionvalue = select.options[select.selectedIndex].value;
span.innerHTML = selectedoptionvalue;
}
$('.sec').each(function(){
var self = $(this);
var span = self.find('span:eq(0)');
var select = self.find('select:eq(0)');
if(span.get(0) && select.get(0)){
_spansel(select.get(0),span.get(0));
select.bind('change',function(){
_spansel(this,span.get(0));
});
}
});
});
function _spansel(select,span){
var selectedoptionvalue = select.options[select.selectedIndex].value;
span.innerHTML = selectedoptionvalue;
}
$('.sec').each(function(){
var self = $(this);
var span = self.find('span:eq(0)');
var select = self.find('select:eq(0)');
if(span.get(0) && select.get(0)){
_spansel(select.get(0),span.get(0));
select.bind('change',function(){
_spansel(this,span.get(0));
});
}
});
});
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询