jQuery enclose text before and after anchor tag in separate spans.

Posted by Devashish Bahri on Stack Overflow See other posts from Stack Overflow or by Devashish Bahri
Published on 2011-03-19T16:08:10Z Indexed on 2011/03/19 16:09 UTC
Read the original article Hit count: 204

Filed under:
|

hey dere, first of all, thnx a ton for taking out time to see my post. i have a big problem with jQuery. i have this code:

<p>Hi. I am your friend. you are my friend.<br> we <a href="both.html">both</a> are friends.</p>

My aim is to enclose the text before the anchor tag as well as after the anchor tag into separate spans. Thus, i want something like this in the DOM:

<p><span>Hi. I am your friend. you are my friend.<br> we </span><a href="both.html">both</a><span> are friends.</span></p>

Can anybody please help me and tell me how to do it in jQuery. PLease... its very important..!! Thnx in advance...

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about dom