Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8074349
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T14:37:15+00:00 2026-06-05T14:37:15+00:00

I found several solutions for hiding divs when they are empty but not in

  • 0

I found several solutions for hiding divs when they are empty but not in connection with a mysql retrieved value.

<button class="platform_category" id="platform_', $platform['platform_id'],'_category"><a href="', $platform['platform_url'],'" target="_tab">', $platform['platform_category1'],'</a></button>

Jquery does not hide div when there is no data in mysql-row because it thinks $platform[‘platform_category1’] is a value even though that is only the php-code to retrieve the mysql value in case there is one.

For the hiding jquery code I am using this:(if I replace the == with != it hides)

    $(function() {
    $('.platform_category').each(function() {
        if ($(this).html() == "") {
             $(this).hide();
       }
    }); 
});
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T14:37:16+00:00Added an answer on June 5, 2026 at 2:37 pm

    Buttons with class platform_category have <a> tag as inner html, so html() method does not make any sense here (it will always return <a>). Try text() instead:

    $('.platform_category').each(function() {
        if ($(this).text() == "") {
            $(this).hide();
        }
    });
    

    GOOD NOTE (from @Blazemonger): It is good to use text trimming with $.trim() method:

    if ($.trim($(this).text()) == "") {
        $(this).hide();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've tried several of the solutions that I've found here, but none seem to
Found several solutions for local, but need one for FTP action: I have a
I've found several solutions online, but none that really do what I'm looking for.
I found partial solutions on several sites, so I pulled several parts together, but
I've looked and found several similar questions but can't seem to make the solutions
I tried several solutions found on other posts but still having problems to autoresize
I found several answers and solutions, but most of it somehow integrated server-side helper.
test image here: http://images.plurk.com/tn_4134189_bf54fe8e270ce41240d534b5133884ee.gif I've tried several solutions found on the internet but there
I have found several topics with this title, but none of their solutions worked
I've got a very strange problem and tried several solutions found in the www,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.