I have the following:
<a title="Home" href="#">Home test test</a>
I can use a.html() to get me “Home test test” but what I need is just the first word “Home”. Is there an easy way that I can do this with jQuery?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
demo http://jsfiddle.net/HvFMp/
split: (further read if you keen) http://www.w3schools.com/jsref/jsref_split.asp
another demo using match http://jsfiddle.net/LAKqB/ (using match)
code
code using match api