Javascript examples for DOM HTML Element:Form Event
Create input and set its attribute value: type, default value, name
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> <script type="text/javascript"> window.onload=function(){//ww w. j ava2s . co m var formElement = document.createElement('input'); formElement.type = 'text'; formElement.defaultValue = "test"; formElement.name="test2"; console.log(formElement); } </script> </head> <body> </body> </html>