Here's what I've come up with based on one response in this Mailing
List, although I think that it's a bit messy. I have a natural regex

$(document).ready(function() {
        $("#Nav li a").each(function() {
                var text = $(this).html();
                $(this).html(text.replace(/([A-Z0-9])/g,'<span class="caps">$1</

On Jun 10, 3:39 pm, 703designs <[EMAIL PROTECTED]> wrote:
> 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");
>         });
> });

Reply via email to