Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

jQuery Highlight Effect On Table Row Styled With Bootstrap

Using Bootstrap 2.0 I've styled a table using .table-striped. I'm updating rows of data via ajax and when the update is complete, I want to highlight the row, which works on rows that don't have a background-color. So basically, the even rows highlight, the odd rows don't. I'm not sure why that is.

I might just be too tired right now but some advice would be appreciated.

I'm using the following code to trigger the highlight:

$("#row_" + id).effect("highlight", {}, 1500);
like image 680
Gregg Avatar asked Feb 25 '12 02:02

Gregg


2 Answers

Run the effect not on the row, but on the cells within the row. All the rows are highlighting, both even and odd. The changing background colour of the odd rows just gets hidden because the table cells' colour is over top.

like image 133
Quasipickle Avatar answered Nov 11 '22 19:11

Quasipickle


Just to add to Pickle's answer that each cell within the row is above the row colour, see the code below for highlighting each cell instead:

$("#row_" + id +" td").effect("highlight", {}, 1500);

(this assumes that no cells are of type "th" on the row, but that can easily be added if required)

like image 2
Tim Head Avatar answered Nov 11 '22 19:11

Tim Head