I'm using jQuery to add elements dynamically to a dropdown but I think I'm mixing syntaxes and would like to go pure jQuery. Currently I'm doing this:
$("#data-source-menu").addClass("menu-container")
.html($("<ul class=\"popup-menu\" id=\"dataset-menu\"><\/ul>"));
Then later
$("#dataset-menu").append($("<div>" + dataset.label + "<\/div>").addClass("menu-item").attr(dataset));
It's that inner building of the html I don't like. Is there a more abstract way to approach this that doesn't involve writing html? Something like JavaScript's document.createTextNode("Hello")?