I have two distinct jQuery objects, one from a selector query and one created from html code. Now I want to make another jQuery object out of these to do operations on both of them.
As you can see here (http://jsfiddle.net/D799Y/), it is possible to do this by using the "get" operation and building an array of elements:
var $first = $('div.first'),
$overlay = $('<div class="overlay" />'),
$list;
$first.before($overlay);
// build list out of elements
$list = $([ $first.get(0), $overlay.get(0) ]);
// modify the list
$list.css('border', '2px solid green');
Is there a way to do make $list directly out of the two jQuery objects? Can you add a jQuery object to another one?
This would also be more interesting if f.i. $first would contain more than one elements.
BTW, I know of this possibility, but it's so unsatisfactory. :)
$list = $(".first,.pane");