I have a dynamically built table that ends with the code below (with examples):
<table id="patientTable" class="display" cellspacing="0" width="100%"> <thead id="TableHeader"> <tr> <th>Value1</th> <th>Value2</th> <th>Value3</th> </tr> </thead> <tbody id="tableContent"> <tr class="clickable row_0" onclick="selectPatient(10001);" id="10001" style="background: #FFF;"> <td class="tableContent">Value1</td> <td class="tableContent">Value2</td> <td class="tableContent">Value3</td> </tr> </tbody> </table>
I am trying to highlight a line that was dependent on the CSS used below:
.clickable :hover { background-color: #CCC; }
For some reason, this will change the background of what will be the " <td> " element, for example, just highlight Value1, Value2 or Value3, and not the entire line.
I tried (to no avail) to use:
.clickable tr:hover { background-color: #CCC; } .clickable:hover { background-color: #CCC; } .tr:hover { background-color: #CCC; } .tr :hover { background-color: #CCC; }
I find this unusual behavior as it seems to work for everyone else in every other example I have seen.
It is worth noting: the table is built from a complex system that basically executes an AJAX request that executes a PHP database query, takes values, issues them to a JSON array, passes them back to JS, parses the array again as JSON, goes through a loop and creates a table, and then displays it. Can JS have a problem?
The class name is ".clickable", "row_ #" (where # is a number), and the table row identifier should remain, as they are used in future functions and provide me with a way to identify each row individually.