Grow your CSS skills. Land your dream job.

Jquery: If ul has no li

  • # January 15, 2013 at 6:41 pm

    Hi Guys,

    I am trying to work out how to check if a UL DOES NOT contain a li … then if it is, add a message to say “sorry this is empty”.

    Any ideas?

    # January 15, 2013 at 6:55 pm

    This should do the trick
    http://codepen.io/karlpcrowley/pen/JboEi

    # January 15, 2013 at 6:58 pm

    Super minor optimization: http://codepen.io/ggilmore/pen/biehl

    # January 15, 2013 at 7:07 pm

    Ah yes, this is why I refactor my code, I always miss ! vs ==0

    # January 15, 2013 at 7:23 pm

    Perfect guys. Thanks so much for your help.

    I’m new to jQuery but very quickly realising the possibilities it opens.

Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".