Reputation: 2461
I am trying to use a jquery selector on an HTML line.
var render = "<div id=\"cellContainer\"></div>";
$(render).find("#cellContainer").append("this is a test");
$("#container").html(render);
For some reason it does not output anything. What am I missing ?
Edit: let me clearify that this is a simplification of my actual code so I'm not looking for alternative ways.
Upvotes: 2
Views: 47
Reputation: 128791
Rather than doing that, you can simply:
$("<div />", {
id: "cellContainer",
html: "this is a test"
}).appendTo("#container");
I suggest you check out both http://learn.jquery.com and http://try.jquery.com.
Upvotes: 5