[Solved] How to get text between tags with regex [duplicate]


Use either the innerText or textContent property of the A element as appropriate:

var theText = aElement.innerText || aElement.textContent;

All browsers in use support one or the other, some both.

If you want to replace the content of all links with plain text, you could do something like:

var link, links = document.links;
for (var i=0, iLen=links.length; i<iLen; i++) {
  link = links[i];
  link.innerHTML = link.innerText || link.textContent;
}

solved How to get text between tags with regex [duplicate]