Saturday, 1 December 2018

html - regular expression to remove links

Regex is generally a bad solution for HTML parsing, a topic which gets discussed every time a question like this is asked. For example, the element could wrap onto another line, either as


  href="[variable content]">X

or


X


What are you trying to achieve?


Using JQuery you could disable the links with:


$("a.development").onclick = function() { return false; }

or


$("a.development").attr("href", "#");

No comments:

Post a Comment