[jQuery] Selector: Find the first letter?
I want to add a class to the first letter of every link in a page's
navigation. Here's what I have now, but I'm missing a way to actually
grab the first letter. This script would add the "caps" class to the
whole link, and I only need the letter. The reason for this is that
the links are using "font-variant: small-caps", and it doesn't make
letters that are actually capitalized large enough to be noticeably
different from their small-caps counterparts.
$(document).ready(function() {
$("#nav li a").each(function() {
this.addClass("caps");
});
});