¿Cómo crear un objeto jQuery vacío y no nulo listo para agregar?
Quiero agregar algunos html a un objeto jQuery vacío no nulo solo en el bucle, pero no funciona a menos que cree un objeto y agregue una etiqueta html durante la creación. ¿Cómo puedo crear un objeto jQuery vacío y poder agregarle html más adelante?
//var $new = $().add(""); //can't use this object in the loop
//var $new = $([]); //can't use this object in the loop
//var $new = $(); //can't use this object in the loop
//var $new = $("#nonexistingelement"); //can't use this object in the loop
var $new = $().add("<tr>"); //works but I don't want to add any html at this point.
$.each(.....)
{
$new.append("<sometag>");
});
alert($new.html()); //should display some html
Adición http: //jsfiddle.net/vfPN/