In this code snippet I will show you that how to create html user form dynamically.

Write down the following code snippet
<html xmlns="">
    <script type="text/javascript">
        function createUserInterface() {
            document.write("<form id='form1'>");
            document.write("Employee Id :&nbsp;&nbsp; <input type='text' id='tt1' /> <br />");
            document.write("Employee Name :&nbsp;&nbsp; <input type='text' id='tt2' /><br />");
            document.write("Employee Age :&nbsp;&nbsp; <input type='text' id='tt3' /><br />");
            document.write("Employee City :&nbsp; <select id='selectCity'><option value='Allahabd'>Allahabd</option>");
            document.write("<option value='Lucknow'>Lucknow</option><option value='Kanpur'>Kanpur</option></select><br />");
            document.write("<input type='button' id='btnSubmit' value='Submit' />");
<body onload="createUserInterface()">
Save the file with .html or .htm extension and open it in browser to see the output

Creating html controls dynamically

  Modified On Mar-22-2018 07:07:28 AM

Leave Comment