Can you guys please help me with this jsFiddle?:
http://jsfiddle.net/4CNKa/2/
I am trying to create new (hidden) objects [ $(object) ] on the fly…with jQuery…but so far, I had no luck.
In this jsFiddle it’s a div, but I want to be able to create any kind of $()
$(document).ready(function() {
$("#msg") = '<div id="msg"></div>';
$("#msg").html('<p id="test">My <em>new</em> text</p>');
//FOR TESTING
alert( $("#msg").text() ); //FOR TESTING ONLY!!!
$("#msg").appendTo('body'); //FOR TESTING ONLY!!!
});
Try this:
Fiddle: http://jsfiddle.net/maniator/4CNKa/3/