Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Remove hyperlink but keep text?

<a href="http://www.website.com/something" title="Show Profile">Mentalist</a> 

Whenever a hyperlink has a title of "Show Profile" I want to remove the hyperlink and replace it with only with the text.

So instead of

<a href="http://www.website.com/something" title="Show Profile">Mentalist</a> 

I want to have only Mentalist.

Any idea how to solve that?

like image 267
matt Avatar asked May 31 '11 13:05

matt


People also ask

How do you remove hyperlink without formatting?

Clear Hyperlinks Without Changing Format Settings You can select a single cell, group of cells, or the entire worksheet. What is this? Under the Home tab, you will find the Clear option in the 'Editing' group. Click on it and select “Clear Hyperlinks” from the dropdown list.

How do you remove hyperlinks at once?

Press Ctrl + A keys at the same time to select the whole document. 2. Next press Ctrl + Shift + F9 keys simultaneously to remove all hyperlinks in the current document.

Can you remove all hyperlinks from a Word document?

Press the “Ctrl + A” hotkey to select all the text in the document. Press the “Ctrl + Shift + F9” hotkey to remove all the links.


2 Answers

this should work:

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

Here a Fiddle with the proof.

like image 145
DanielB Avatar answered Sep 23 '22 03:09

DanielB


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.

like image 20
rciq Avatar answered Sep 20 '22 03:09

rciq