referencing DOM elements in jQuery

Posted by Lyon on Stack Overflow See other posts from Stack Overflow or by Lyon
Published on 2010-04-19T05:41:23Z Indexed on 2010/04/19 5:53 UTC
Read the original article Hit count: 345

Filed under:
|

Hi,

I would select multiple DOM elements using a typical code such as this:

$('#ele1, #ele2, #ele3').click(function () {});

If I have variables of each DOM element, e.g.

var domEle1 = $('#ele1');
var domEle2 = $('#ele2');
var domEle3 = $('#ele3');

How can I select them all at once? Instead of individually...

domEle1.click(function () {});

Thanks!

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about dom