Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jquery referencing multiple elements in one line

How can i write this in one line.

$('#id').whatever();
$('#id1').whatever();
$('.class').whatever();
like image 325
Hussein Avatar asked Jan 16 '11 01:01

Hussein


1 Answers

As with CSS, you can use commas to join together multiple distinct selectors:

$('#id, #id1, .class').whatever();
like image 68
Phrogz Avatar answered Oct 20 '22 17:10

Phrogz