I am attempting to modify the background of a table row <tr>
in a data table using the following code snippet.
var lastIdx = null;
var t = $("#campaigns_list").DataTable();
t.rows.add(['.$str_json.']).draw();
$("#campaigns_list tr").not(":first").hover(
function() {
$(this).css("background", "yellow");
},
function() {
alert("bye");
}
);
However, for some reason, the background-color of the <tr>
is not changing as expected:
$(this).css("background","yellow");
Despite the hover function triggering, the color change does not occur. Interestingly though, when I replace the CSS line with an alert message, it functions correctly.