I have a situation where I\'m appending a node inside an element and would like a reference to it right away.
At the moment I do something along these lines:
You can do
var current = $('<p>hello</p>').appendTo('#elem');
Is this what you mean?
var current = $("#elem").append("<p>hello</p>").children(':last');