js中,如何把这三个绑定写成一个?

$('#hetong_fu1').bind('inputpropertychange',function(){
debugger;
$('#deposit1').val(car_deposit());
});
$('#hetong_ya1').bind('inputpropertychange',function(){
debugger;
$('#deposit1').val(car_deposit());
});
$('.floor_rent').bind('inputpropertychange',function(){
debugger;
$('#deposit1').val(car_deposit());
});
手掌心
浏览 275回答 2
2回答

幕布斯6054654

$('#hetong_fu1,#hetong_ya1,.floor_rent').bind('inputpropertychange',function(){debugger;$('#deposit1').val(car_deposit());});

慕码人2483693

先为这些元素添加一样的classname,比如hetong,然后jq有隐形迭代,下面这么做就可以了。$('.hetong').bind('inputpropertychange',function(){debugger;$('#deposit1').val(car_deposit());});
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

JavaScript