JavaScript Reference/Javascript Methods/createElement
"createElement()" Example
<html>
<body>
<script language="javascript">
function function1(){
var myElement = document.createElement("<hr>");
myBody.appendChild(myElement);
myElement = document.createElement("<Br>");
myBody.appendChild(myElement);
myElement = document.createElement("<Hr>");
myBody.appendChild(myElement);
}
</script>
<body id="myBody">
<button onClick="function1();">Put horizontal rule</button>
</body>
</html>
"createElement()" is applied to
+----------------+--------------------------------------------------------------+
| Applied_To |document |
+----------------+--------------------------------------------------------------+
"createElement()" Syntax, Parameters and Note
Note:
Creates a new element.
Syntax:
document.createElement(param1)
Parameters:
param1 Required; the tag name of the new element.