Use Jquery to hide a div if no content is present based on the page url

I am currently working on a site (built using .jsp and java) where most of the pages are controlled by templates. It is a card store (greeting cards etc etc) and once you click on a main category cards.jsp takes over and displays the results. I was asked to add in a few tweaks to cards.jsp to pull out some data from the database and display some content.

However, we ran into a problem with all of this. For every category and subcategory (data is entered into the backend and stored in the database through forms), the new data is being displayed just fine. The issue comes into play when a user enters in a search term or clicks on the “new card” category. Both of these are still controlled by the cards.jsp and have no real section in the backend. This results in a big div being displayed for these sections with no content.

I was wondering if it were possible (using jquery), to hide the div if the url in the address bar equaled a certain phrase ie.

You can see a subcategory here->
As well as a search page here ->

newest questions tagged jquery – Stack Overflow

About Admin