/ Published in: JavaScript

Basic create element and append it too another element.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
var root = document.getElementById("root"); var a = document.createElement("a"); a.setAttribute("href", "http://foobar.com"); a.setAttribute("title", "Foo Bar"); root.appendChild(a);
Comments
