I'm importing an HTML file and I want to remove all href
from all elements on it, so the final text doesn't link anywhere and appears like "normal" text.
I'm already taking just a part div#divvy
from this HTML, so the process of removing href
must works on it and not on all the response.
The final result should go to div#pepeland
.
I have this code:
function pepe(){
$.ajax({
url: 'http://www.site.com/text.html',
dataType: 'html',
success: function(response){
$('#pepeland').html(jQuery(response).find('#divvy').html());
}
});
};
I think but am not sure that maybe I should insert something like one of these following lines inside the above code, but I don't know how to do it.
$(response).querySelectorAll("href").remove();
or
$(response).attr('href', '');
or
response.replace("href", '');
on below answers, i realize that what i want is to remove all the tag without removing the text. Because the words keeps formatted with underline and all the attributes of the tag. So roasted wrote my the right answer for this, see below!