So far, I've got this code:
$("<div/>", {
"id": "myId",
"class": "myClass",
"html": "Hello world!"
}).appendTo("#myContainer");
This appends
<div id="myId" class="myClass">Hello world!</div>
to #myContainer, as one would expect.
But instead of appending, I would like to have it replace the contents. I'm imagining something like this:
$("#myContainer").html("<div/>", {
"id": "myId",
"class": "myClass",
"html": "Hello world!"
});