Skip to content

Instantly share code, notes, and snippets.

@msmorgan
Created December 16, 2011 17:47
Show Gist options
  • Save msmorgan/1487099 to your computer and use it in GitHub Desktop.
Save msmorgan/1487099 to your computer and use it in GitHub Desktop.
//Which is more understandable, assuming you're not familiar with any JavaScript APIs?
//jQuery
$("<li/>").text("hello, world").appendTo($("<ul/>")).parent().appendTo(document.body);
//plain old JavaScript
var li = document.createElement("li");
li.appendChild(document.createTextNode("hello, world"));
var ul = document.createElement("ul");
ul.appendChild(li);
document.body.appendChild(ul);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment