Jquery select first letter?
Posted
by Batfan
on Stack Overflow
See other posts from Stack Overflow
or by Batfan
Published on 2010-06-14T17:28:32Z
Indexed on
2010/06/14
17:32 UTC
Read the original article
Hit count: 221
I am simply attempting to get jquery to identify the first letter of a paragraph. How would I do this?
For example, I have a page with a number of paragrahs on a page. I would like only the paragraphs starting with a specified letter to be given the class "current" and all others to be hidden. I pretty much know how to add the class and hide the others but, I cant get jquery to recognize the first letter.
Secondly, is it possible to pull this 'first letter' variable from the url string?
For example, Page 1 - There is a list of letters. The user clicks 'B' and the url is
http://domain.com/page2.html?letter=b
And page2 picks up that variable (b) and applies it to the Jquery, showing only those paragraphs
© Stack Overflow or respective owner