Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Hiding an Empty Div with jQuery

  • This topic is empty.
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #38199
    jcoder
    Member

    Hi all – I have been having such a hard time trying to hide a div that is empty with jQuery. Any Ideas?

    $(document).ready(function() {
    if($(".itemBubble").html() == ""){
    $(".itemBubble").addClass("visuallyhidden");
    }
    });



















    #103411
    timmey
    Member

    well the problem is that you have multiple divs with class .itemBubble i guess.
    you have to use something like each. dont know if theres a better way, im no expert.. but maybe it helps:
    http://jsfiddle.net/wHpkw/4/

    #103412
    jcoder
    Member

    Thanks! I figured out that it wasn’t working because I had some weird spacing going on.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.