Possible Duplicate:
jQuery: Select <a> which href contains some string
I am working on a little twitter implementation for a website. The javascript I use exports the code as following:
<ul>
<li>twitter message here <a href="http://twitter.com/username/ID">time of twitter</a></li>
</ul>
Now I like to add a class to the twitter link, so I can give it a different css then normal links inside the tweets.
Anyone got any thoughts how to fix this in a proper way? :)
$('a[href^="http://twitter.com"]').addClass('twitter');
http://jsfiddle.net/apjD6/
$(function() {
$("a[href^='http://twitter.com/']").addClass("someClass");
});
Check reference here:
http://api.jquery.com/attribute-starts-with-selector/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With