I am currently pulling in data from Google Sheets into a table in my website. I would like to be able to hide TR if TD is empty. I have already got this working but since i am pulling in from Sheets using an ID it is not working - I guess it doesn't know if there is a number in the table.

I am currently using this which hides rows if a cell is empty.

$('.hidetable tr:has(td:empty)').hide();

I pull in data from sheets using an id:

<td id="podiumt"></td>

Surely it shoud be working if the below styling is converting it to a number?

I am also using this to apply some styling to the number that is imported:

let divs = Array.prototype.slice.call(document.querySelectorAll("podiumt"));

    // Loop the array
        // Convert text to number and test for positive/negative
        if((+div.textContent) >= 0){
        div.classList.add("positive"); // Apply positive style
        div.textContent = "+" + div.textContent; 
        } else {
        div.classList.add("negative"); // Apply negative style  

0 Answers