有这段代码:
var firstname = $('#Passenger_FirstName');
var lastName = $('#Passenger_LastName');
$('#Passenger_FirstName,#Passenger_LastName').keyup(function () {});
我想这样用:
$(firstname,lastname).keyup(function () {});
但选择器似乎没有正常工作,任何想法?
答案 0 :(得分:4)
您也可以使用.add()
firstname.add(lastName).keyup(function() {});