Changing a TD into a TH in an existing table

Changing a TD into a TH in an existing table

Hi all,

We're using a 3rd party widget to generate some data-grids. For accessibility reasons, I need to change some of the TD's into TH elements and add a "scope" attribute.

I'd rather not hack around in the 3rd-party source code to do this, as I thought jQuery should be able to handle it.

Here's my code:

 
  $("#mytable td.cell-label").after("<th scope='row'>NEW TH</th>");
  $("#mytable td.cell-label").remove();
 


NOTES:

* All the TD's with the css class "cell-label" should be turned into "TH" elements.
* The new TH's are being added just fine, but it won't remove the TD's.
* What am I doing wrong? Or is there an easier method?

Thanks in advance for any help!