[Solved] How I can get all values using javascript from html table, into array associative or something


var names = document.getElementsByClassName("first");
var quantities = document.getElementsByClassName("quantity");
var costs = document.getElementsByClassName("cost");
var books = [];
for(var i=0; i < names.length; i++)
{
    name = names[0].innerText;
    quantity = quantities[0].value;
    cost = costs[0].innerText;
    books.push({name:name, quantity:quantity, cost:cost});
}

console.log(books);

Here’s the jsfiddle http://jsfiddle.net/8c0cwxh7/4/

solved How I can get all values using javascript from html table, into array associative or something