<html>
<body>
<p>Click the button to create a FORM and an INPUT element.</p>
<button onclick="myFunction()">Try it</button>
<script>
function myFunction() {
var x = document.createElement("FORM");
x.setAttribute("id", "myForm");
document.body.appendChild(x);
var y = document.createElement("INPUT");
y.setAttribute("type", "text");
y.setAttribute("value", "Donald");
document.getElementById("myForm").appendChild(y);
}
</script>
</body>
</html>