---
title: "Creating html controls using Java Script"  
description: "In this demonstration we learn, how to create html control by using java script.  Following code snippet demonstrate to creating html controls in java"  
author: "Anonymous User"  
published: 2011-03-12  
updated: 2020-07-24  
canonical: https://www.mindstick.com/articles/489/creating-html-controls-using-java-script  
category: "javascript"  
tags: ["javascript"]  
reading_time: 1 minute  

---

# Creating html controls using Java Script

In this demonstration we learn, how to create html control by using java script.\

##### Following code snippet demonstrate to creating html controls in java script.

```
<script type="text/javascript">        function createHtmlDocument() {              //creating html button in hava script.            var button1="<input type='button' value='Html Button in Java Script' id='btn1' /><br />";            document.write(button1);                        //Creating html text field in java script.            var textbox =  "<input type='text' id='tt1' value='This is a text box control.' /> <br />";            document.write(textbox);              //Creating radio button by using java script.            var rdb =  "<input type='radio' name='rd' id='male' value='Male' /> <br />";            document.write(rdb);          }</script>
```

At the load event of the body call this function.

```
<body onload="createHtmlDocument()">    </body>
```

##### Output of the following code snippet is as follows

![Html controls using Java Script](https://www.mindstick.com/mindstickarticle/000a7f89-1a7d-4606-805e-7378982694b1/images/c2ef9170-50cc-4b17-9e85-f7ebf90412e8.png)

---

Original Source: https://www.mindstick.com/articles/489/creating-html-controls-using-java-script

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
