How to Hide Tooltip if Value of the cell is Empty
How to Hide Tooltip if Value of the cell is Empty
I am using hidden column to display the tooltip for datatables. It works fine but it shows tool tips on every cell of the table. Is there a way to hide the tooltip if the cell value is empty.
Please see my code here -https://live.datatables.net/jebatava/3/edit
From my example, the first row should not show tool tip on Test 6, Test 7 etc columns, second row should not show tooltip on Test4, Test 5 columns. Any help/advice appreciated. Thanks.
This question has an accepted answers - jump to answer
Answers
Looks like these cells have a single space created with
 
. You will need to adjust your if statement to account for the whitespace, something like thisif (cell.innerText.trim() !== '') {
. Updated example:https://live.datatables.net/jebatava/4/edit
Kevin
Thankyou. That did it!
I just tested the tool tip using screen reader for 508 complaince and it seems the screenreader does not read the tool tip. Any idea why? Please let me know if you want me to open a seperate question for this. Thanks.
You'd probably need to refer to the support / documentation for the screen reader you are using. I'm not sure what the rules they apply are for what happens with a
title
attribute for atd
.I doubt that is DataTables specific - presumably it happens with even just a plain HTML table?
Allan