How to style specific a tag

css, html, javascript, jquery, styling

Solution

You can use attribute contains selector:

$('a[href*="pinterest"]').css('color','DeepSkyBlue');

or better just need pure css:

a[href*="pinterest"] {  
    color: DeepSkyBlue;
} 

Fiddle

Problem

I have a lot of links look something like this: ``` <a href="http://www.youtube.com/user/nigahiga">Youtube</a> <a href="http://pinterest.com/pin/41236152807615600/">Pinterest</a> <a href="https://www.facebook.com/manchesterunited">Facebook</a> <a href="http://www.youtube.com/user/RayWilliamJohnson">Youtube</a> <a href="http://pinterest.com/pin/24910604158520050/">Pinterest</a> ``` How can I style only the hyperlinks that will be linked to `pinterest`. I tried this: ``` $('a').attr('href').contains('pinterest').css('Styling here'); ``` But it does not work. How to achieve it?

Original source