i create new div, and how insert text(html text) in this new div?
var div_obj = $(document.createElement("div")).attr({'class': 'test'}).css({'width' : size, 'height' : height, 'background' : bg});
I try:
div_obj.innerHTML = "text";
But don’t work.
Use
.html()here, like this:.innerHTMLis a DOM element property (not a jQuery object one), to access it you’d need to get the raw<div>DOM element, like this:As an aside: in jQuery 1.4+ there’s a shorthand for creation,
$(html, props), like this: