I got a script that count all td
with the same value's in my table. The output is just what i need.
But it goes wrong when i want to print the data to html. When i do console.log
i get
Object {EANDIS - RC GROND 2014-2018: 11, ASWEBO - FARYS: 7, VDV CLEANING - RIOOLKOLKENSLIB: 1}
I have tried to print it out with: document.getElementById("write").innerHTML = byTechnology;
But the output is Objectobject.
What am i doing wrong? Or is their another way to do it?
Here you will find the script. I hope you can help me!
<script>
var byTechnology = {};
$("#test tbody td:nth-child(6)").each(function() {
var tech = $.trim($(this).text());
if (!(byTechnology.hasOwnProperty(tech))) {
byTechnology[tech] = 0;
}
byTechnology[tech]++;
});
console.log(byTechnology);
document.getElementById("test").innerHTML = byTechnology;
</script>