the td id='data' has the value below
['car', 7],['jeep', 2],['taxi', 1]
I want to get the value of 'td tag' and put on "Google Chart" arrayToDataTable
i tried this but not working
var x = document.getElementById('data').innerHTML; var data = google.visualization.arrayToDataTable([ ['Data', 'Value'], x
]);
Can anyone tell me how to do it.... need help
you need to add brackets and make an array out of the string (innerHTML / innerTEXT) that you get from the TD and then add those rows.
Be sure the TD is inside TR and that is inside TABLE, or use a DIV instead of a TD
Anyway: working fiddle here : https://jsfiddle.net/L3tNE/15/