---
title: "Creating html controls dynamically"  
description: "In this code snippet I will show you that how to create html user form dynamically.  Write down the following code snippet        function createUserI"  
author: "Anonymous User"  
published: 2011-03-12  
updated: 2020-03-04  
canonical: https://www.mindstick.com/articles/490/creating-html-controls-dynamically  
category: "javascript"  
tags: ["javascript"]  
reading_time: 1 minute  

---

# Creating html controls dynamically

In this code snippet I will show you that how to create html user form dynamically.\

##### Write down the following code snippet

```
<html xmlns="http://www.w3.org/1999/xhtml"><head>     <title></title>     <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' />");            document.write("</form>");        }             </script></head><body onload="createUserInterface()">    </body></html>
```

##### Save the file with .html or .htm extension and open it in browser to see the output

![Creating html controls dynamically](https://www.mindstick.com/mindstickarticle/ddeb7aa7-52f9-40bd-9161-90497374e9b0/images/3e2c8b6f-6391-45c4-af68-c622525a43b9.png)

\

---

Original Source: https://www.mindstick.com/articles/490/creating-html-controls-dynamically

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
