I am building my own JS library backed by jquery. The constructor starts building on top of an existing div to flesh it out. In the library I am making an ajax call, so to this initial div I know how to append like (where this is the initial div passed in):
var t = this;
var sdiv = t.append("<ul class='foo'></ul>");
So now I need to loop through and append elements to the variable "sdiv". For some reason
$(sdiv).append("<li class='bar'>" + element[i] + "</li>");
isn't working/rendering. How do you append elements to other elements created as variables?
Thanks
var t = thisrefer to? Could it be pointing to window? If not have you considered that it should bevar t = $(this)?