I've looked at a lot of stack posts and Google results but I can't quite find my answer... I have this snippet of text.
<p>Lorem [email protected] , consectetur adipisicing elit. Eos, doloribus, dolorem iusto blanditiis unde eius illum consequuntur neque dicta incidunt ullam ea hic porro optio ratione repellat</p>
I'm trying to target the email addresses and then underline them. It's important that the body is selected rather than the <p> tag. I've made an expression that I know works since I made it via RegexPlanet.
So far, I have this:
var result = $("body").text();
var newResult =result.replace("\b[\w\.-]+@[\w\.-]+\.\w{2,4}\b", "REPLACED");
console.log(newResult);
But it doesn't seem to work... If you go to this Here and then click JavaScript, you will see the result of input.replace(). That is essentially what I'm after but I'd also like to be able to use jQuery's .css() function.
How can I do this?
.csscome into play?text()you will strip all HTML from the page.