@daniel1836 IDs should only be used once on a page. If you want to apply styles to multiple elements, use a class (i.e. `.highlight) instead of an ID.
May 25, 2021
7
Level 6
How to use 'this' keyword with onclick function.
I know this is probably not the best method to use, but try to help me out.
I want to highlight my table's row on submit. To indicate it has been affected.
I have an onclick function inside a button in my table. It is within a while loop.
onlick="my function(this)"
I have my row defined by an ID.
Inside my JavaScript function I want to use jQuery to style that ID.
$('#highlight').css("background-color","grey");
Right now, it only highlights the first row of the table.
How do I make it find the current row of the button clicked and highlight that row?
Thanks
Please or to participate in this conversation.