[jQuery] Re: Selector: Find the first letter?

2008-06-10 Thread 703designs
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 aversion... $(document).ready(function() { $(#Nav li a).each(function() { var text = $(this).html();

[jQuery] Re: Selector: Find the first letter?

2008-06-10 Thread Hamish Campbell
Nothing wrong with regex. Note that the expression you have will catch all Caps and Numbers - so something like Go Here will have the G and H in the spans. A better pattern might be /^([A-Za-z0-9])/g -- this will match the first character of the link, but only if it is a sensible character (ie,

[jQuery] Re: Selector: Find the first letter?

2008-06-10 Thread Karl Swedberg
You might also want to take a look at my Fancy First Letter plugin: http://plugins.learningjquery.com/fancyletter/ --Karl Karl Swedberg www.englishrules.com www.learningjquery.com On Jun 10, 2008, at 6:47 PM, Hamish Campbell wrote: Nothing wrong with regex. Note that the