Search code examples
javascriptjqueryhref

How to hide all links of specific class with specific href


I'm looking for a way to hide all links of class "checkme" that have href equal to "href1" OR "href2" OR "href3" on page load.

Any javascript or jQuery sollution for this?


Solution

  • You can do it with CSS:

    a.checkme[href='href1'],
    a.checkme[href='href2']
    {
        display: none;
    }
    

    http://css-tricks.com/attribute-selectors/

    http://jsfiddle.net/78zrnnvz/

    I appreciate you asked for a js/jq solution, but it seems unnecessary in this situation