jQuery Not Class Selector to Exclude

Written by

in

,

For example we want to hide all hyperlinks that do not have “banana” class. How to do that with jQuery?
You can use the javascript code below.

$('a').not('.banana').hide();

Easy right? 😀

Comments

3 responses to “jQuery Not Class Selector to Exclude”

  1. takien Avatar
    takien

    alternatively you can use :not selector, like this:

    $(‘a:not(.banana)’).hide();

    easier right? 😀

    1. Xrvel Avatar

      Mantap gan 😀

  2. Anime Feed Avatar
    Anime Feed

    mantap,simple banget 🙂

Leave a Reply

Your email address will not be published. Required fields are marked *