问题
How can i write this in one line.
$('#id').whatever();
$('#id1').whatever();
$('.class').whatever();
回答1:
As with CSS, you can use commas to join together multiple distinct selectors:
$('#id, #id1, .class').whatever();
来源:https://stackoverflow.com/questions/4703325/jquery-referencing-multiple-elements-in-one-line