jQuery Selector: Attribute Filters
I just did a lazy thing. I decided I wanted all the links on my site that link to RSS feeds should have a relevant icon.
There's a link i the footer, which would have been easy to fix, but some bulleted links in body copy somewhere.
Two factors kick in at this point:
A) I couldn't be bothered to root out all the links within content
B) My TinyMC WYSIWG isn't best-suited to handle adding classes to links anyway.
So I used jQuery:
$("a[href$='.xml']").addClass("rss");
This attribute selector basically says: "all links that have a href attribute value that ends with .xml".
Which solves my problem.
Latest Posts
Walking In Andorra
5:24p.m., 11 Jul
I've just returned from a week in Arinsal, Andorra. It's a popular ski resort, but almost the whole town seems ...A New Mix In The Cloud
5:27p.m., 30 May
I uploaded a new mix to mixcloud.com yesterday. The notion for the mix came from the grunge podcast we recorded ...League One Round-Up, Player Of The Year Awards 2009-2010
5:53p.m., 19 May
I've enjoyed this 2009/2010 football season. Huddersfield Town have managed to put together a young, hungry side with a smattering ...Wii Sports Resort Table Tennis - Tips To Beat Lucia
7:02p.m., 25 Apr
I love my Nintendo Wii. Partly it's because of the Wiimote, but mostly I love games that are simple to ...