I am trying to create ul and li element in my codes by using javascript. I have following:
var test=document.createElement(\'section\');
test.setAttribute(\'
Great then. Let's create a simple function that takes an array and prints our an ordered listview/list inside a div tag.
Step 1: Let's say you have an div with "contentSectionID" id.
Step 2: We then create our javascript function that returns a list component and takes in an array:
function createList(spacecrafts){
var listView=document.createElement('ol');
for(var i=0;i
Step 3: Finally we select our div and create a listview in it:
document.getElementById("contentSectionID").appendChild(createList(myArr));