jQuery Not Class Selector to Exclude

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? ๐Ÿ˜€


Posted

in

,

by

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 *