I've been using jQuery for a few months now, trying to convert all my hand-rolled javascript and came across a minor problem that I could not find documented anywhere:
I want to create DOM elements and add them into a jQuery object, as in;
var result = [empty jQuery object];
$.each(...
var element = ...;
result.add(element);
);
But how to create an empty jQuery? Scouring the source code, I eventually hit upon $([]), but this is nowhere documented. Is there a better way?
Is there a good reason $() should return $(document) rather than an empty jQuery?
Daniel Wachsstock
http://youngisrael-stl.org