Web Hosting Forum - Net Hosting Talk

We are a community of individuals and businesses passionate about web hosting. Let's build, learn, and grow together.

JavaScript How to hide an empty row?

Antoniorth

Newbie
Registered
Hello,

I have a straightforward 3 x 10 grid, but depending on the input, I want to hide various rows containing no data.
 
  • Advertisement
  • You didn't post any html, but this seems easy enough to psuedocode. Depending on the content, you can check if a certain html element has any text to it.

    JavaScript:
    if (element.innerText === "") {
      element.style.display = "none";
    }

    How to do it if you want to check if the html element has any children elements:

    JavaScript:
    if (!element.hasChildNodes()) {
      element.style.display = "none";
    }
     
  • Advertisement
  • Advertisement

    Back
    Top