var name = document.createElement("Div" );
will work. And later you can add attributes like
name.colSpan="2";
document.body.appendChild(name);
Note. Do not try to use angular brackets, for example createElement("<div />"). It will not work in Chrome.
Edit: The syntax problem in the above code has been fixed. instead of a comma there should be a period.
source
share