Output array to <LI> element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Li


Output array to <LI> element

Demo Code

ResultView the demo in separate window

      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript">
    window.onload=( function() {/*from   w  ww.j  a  v  a2 s  . co m*/
var books = [
var html = "";
for (var i =0; i < books.length; i++) {
    html += "<li>" + books[i]+ "</li>";
document.getElementById("books").innerHTML = html;

      <ol id="books"> 

Related Tutorials