Having some code like this one
$a = $('#a');
$b = $('#b');
$c = $('#c');
$('#a, #b, #c').keyup(function () {
//Event handling
});
I would like to know
Of course, using cached elements is better for performance. If you want to bind a function on multiple cached elements, you can use .add()
:
$a.add($b).add($c).keyup(function(){});
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.