Remove hyperlink but keep text? Remove hyperlink but keep text? jquery jquery

Remove hyperlink but keep text?


this should work:

$('a[title="Show Profile"]').contents().unwrap();

Here a Fiddle with the proof.


This will do:

<a href="http://www.website.com/something" title="Show Profile">Mentalist</a><a href="http://www.website.com/something" title="Something Else">Mentalist</a><script type="text/javascript">$("a[title='Show Profile']").each(function(){    $(this).replaceWith($(this).text());});</script>

It should replace only the first link.


To do this on links of multiple classes,

$("a.className1, a.className2").contents().unwrap();