Jquery to find a name on html page and add hyperlink

Posted by mikejones12 on Stack Overflow See other posts from Stack Overflow or by mikejones12
Published on 2010-04-21T14:13:30Z Indexed on 2010/04/21 14:23 UTC
Read the original article Hit count: 323

Filed under:
|
|

Here is my example: I have a a website that contains the following:

<body>
Jim Nebraska zipcode 65437
Tony lives in California his zipcode is 98708
</body>

I would like to be able to search for zip codes on the page and wrap them with hyperlinks like:

<body>
Jim Nebraska zipcode <a href="/65437.htm">65437</a>
Tony lives in California his zipcode is <a href="/65437.htm">98708</a>
</body>

Could I use a regex selector to find the string and then wrap the string, or replace it with the new hyperlink?

I am new to Jquery and looking for someone to point me in the right direction.

Thank you,

Mike

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about JavaScript