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];
var rowhtml = '
' + oddPositionVal + ' ' + evenPositionVal + '
';
$('#table').append(rowhtml);
}
http://stackoverflow.com/questions/25761856/how-to-get-odd-even-value-from-array-and-display-in-table-using-javascript
It Provides services Such as Mobile app development, Web App Development & Custom Web application
ReplyDeleteKnow About Online Passport Application Process Step by Step Process to apply Passport Online Application Form? Appointment Scheduling, click here to know more.
ReplyDeleteonline passport application form
Stay connected with your friends and family with Idea's Mobile internet. Get best plans and experience superfast Internet across India.
ReplyDeleteIdea 3G Prepaid Tariff Plans