How do I get the rows and columns from a tbody in javascript?
<p>I'm trying to apply css classes to a calendar after it's been loaded. I've confirmed everything in the javascript and the method in the controller works as it should until I try to get the rows from the tbody. here's the javascript. </p>

<pre><code>jQuery(document).ready(function() {
    var calendar = $('#Trafikkalender');
    var date = $('#selectedDate').val();
    var param = { date: date }
    var url = $('#calArrayPostUrl').data('url');
    $.post(url, param, function(data) {
        var body = calendar.find('tbody');

        //var rows = body.getElementsByTagName('tr');
        var rows = body.rows;

        for (var i = 0; i &lt; rows.length; i++) {
            //var cols = rows[i].getElementsByTagName('td');
            var cols = rows[i].cells;
            for (var j = 0; cols.length; j++) {
                var col = cols[j];
                col.addClass(data[i][j]);
            }
        }
    });
});
</code></pre>

<p>when I hover over rows in the debugger in chrome it dsays that rows is undefined. as you can see I've tried another approach but getElementsByTagName is not a function according to chrome. </p>