Is there a good way to .appendTo
either one element or the either depending on if it exists in the DOM?
So for example ideally I would like to do
ideal method 1:
.appendTo($('#div1') || $('#div2'));
not so good method 2:
var div1 = $('#div1'),
div2 = $('#div2'),
e = div1;
if (!div1.length) e = div2;
.appendTo(e);
Of course I can't do the first option because $() always returns an object so it will evaluate to true alert($ || 'a');
will always return the jQuery object.