To show use of both we have created a simple HTML page into which we are going to add one select box with three of it's options. For this purpose we have added a button into the HTML page it calls the method addOptions() on the click event.
In the very first line of code we have held the HTML code as a string format into a variable txtValue and in the second line of code we have first taken the "myDiv" element's reference and after having reference we will assign the value of variable "txtValue" into the myDiv's inner code with line :
Here is the full example HTML code as follows :
As soon as you will click on the "Add Option" button it will generate the HTML code and will add this code into the div with help of innerHTML attribute property.
Rs. 20,000 US$ 300
Today: Rs. 10,000 US$150
Course Duration: 30 hrs
Posted on: April 18, 2011 If you enjoyed this post then why not add us on Google+? Add us to your Circles