Setting class on td with attr

Setting class on td with attr

Hi,

I am pretty new to jquery and am trying to set the class value on a td cell.  It looks as though it is crashing on setting the attr value.  This is effectively what I am trying to do.

// get my row
var row = $("#tableID").find("tr:eq(0)");

// get the cells in this row
var cells = row.find("td");

// manipulate the cells
cells[1].innerHTML = "Some Text";
cells[2].attr("class", "my-class");

Setting the innerHTML works fine, so I am assuming everything before that is working correctly.  When I try to set the class, it is not applied and IE does throw an error stating this "object does not support this property or method".

I am assuming that cells[2] is not strictly a td object judging from the error.  Do I need to get a child of this object or something similar?

Thanks for any help