Given an HTML table and the task is to access the table element from the Controller and highlight any row that we want.
- getElementById() Method: To select any element in HTML from its ID, we will select the table to perform the above operation.
- addEventListener() Method: After selecting this table, we will add an Event Listener to listen from the click event.
- path: When we click at any point on window then Path describes its complete path that it belongs to. For example, if we click to a td element of a table, then its Path will be [td, tr, tbody, table, body, html, document, Window].
- After selecting the row, we will look for highlight class in its classList, if we found it simply remove this class or add if it do not contain it.
- How to add table row in a table using jQuery?
- How to remove table row from table using jQuery ?
- How create table without using <table> tag ?
- How to create table with 100% width, with vertical scroll inside table body in HTML ?
- How to make Bootstrap table with sticky table head?
- How to change opacity of every data element on hover in a table using CSS ?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.