jeudi 9 avril 2020

How to hide display of an object from an API?

I'm working with a search result page that shows all articles that have been published in the site. I am trying to hide the article about technology from appearing in the search result. This data is coming from an API. I created a CSS hide-search to have a display:none. Going with this route I need to do two condition checks in order to hide the title and the description appears below it. I am currently getting the results I want but is there more efficient way of doing this?

This is my code currently checking if the title equals technology.

} else if (data.ReportTitle === "Technology") {
       document.body.classList.add("hide-search");
        }

Aucun commentaire:

Enregistrer un commentaire