How to remove the anchor tag text and href link using javascript
Or Jquery
<a id="ancID" href="Javascript:void(0)">Here insert a dynamic text </a>
I want to remove the text inserted between anchor tag..
How to remove the anchor tag text and href link using javascript
Or Jquery
<a id="ancID" href="Javascript:void(0)">Here insert a dynamic text </a>
I want to remove the text inserted between anchor tag..
Share Improve this question asked Dec 17, 2013 at 6:39 bgsbgs 3,2237 gold badges42 silver badges59 bronze badges 1- using javascript regex can anyone help? – yaswanthkoneri Commented Nov 26, 2019 at 13:23
2 Answers
Reset to default 4You can use .text('')
to remove text by assigning empty string. First use id selector to get the anchor tag.
Live Demo
$('#ancID').text('');
If you go the vanilla way:
var x = document.getElementById("ancID");
x.innerHTML = "";
x.href = "";