# Add style attribute to table cell

**URL:** <https://forum.kirupa.com/t/add-style-attribute-to-table-cell/278319>\
**Category:** web dev\
**Created:** [December 27, 2008, 6:06am UTC](https://forum.kirupa.com/t/add-style-attribute-to-table-cell/278319 "2008-12-27T06:06:55Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![NeoDreamer](https://avatars.discourse-cdn.com/v4/letter/n/ccd318/32.png) [@NeoDreamer](https://forum.kirupa.com/u/NeoDreamer)\
**Post date:** [December 27, 2008, 6:06am UTC](https://forum.kirupa.com/t/add-style-attribute-to-table-cell/278319/1 "2008-12-27T06:06:55Z")

</div>

I wrote code to put a border around all cells in a specific table column. I used “firstChild” and “nextSibling” in a double nested while loop to locate all of the cells in that column. Now when I did:

```php

tableCell.setAttribute("style", "border = 1px solid #BFD44B");

```

I get the error in Firebug: tableCell.setAttribute is not a function. I verified that tableCell is a “HTMLTableCellElement” by alerting it. I’m completely new to JS, so…
