var dataArr = ["1","Maths","2","Science"];
Add a bare bones table to a div.
$("#subjectTable").append('
');
For each table row loop over the array in steps of 2 (i+=2). oddPositionVal is the first element in the step, evenPositionVal is the second element.
Build the row HTML and then append it to the table.
for (var i = 0, l = dataArr.length; i < l; i+=2) {
var oddPositionVal = dataArr[i];
var evenPositionVal = dataArr[i + 1];
...
This blog related to all the experience that i gain and face during past career. It covers Microsoft technology like. Microsoft Dot Net, SQL Server, Scripting Language etc,.
Pages
Monday, February 27, 2017
How to get odd/even value from array and display in table using Javascript
Read More »
Subscribe to:
Posts (Atom)
My Blog List
-
-
-
-
Kumaon University Nainital B.Ed entrance exam test result 2012 - कुमाऊँ विश्वविधालय, नैनीताल (उत्तराखण्ड)11 years ago