Javascript examples for DOM HTML Element:Div
Append text to div using ID in javascript
<html> <head> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <body> <div id="mylist"></div> <script type="text/javascript"> function coucity(){/*from w w w . ja v a 2 s . c o m*/ for (var i = 0; i < 10; i++) { printList(i); } } function printList(city){ var writecity = document.createTextNode(city); document.getElementById("mylist").appendChild(writecity); } coucity(); </script> </body> </html>