For some reason \n isn't working for me in javascript. Is there anyway to fix it or use html? In my case, I think that using <br> will not work in my href. What are your suggestions.
Working JSFiddle here.
HTML:
<a id = 'emailoff' href = "" target = "_blank">
<div id= "btn1">
<h2 id = "enter">Send Email</h2>
</div>
</a>
Javascript:
$('#btn1').click(function() {
$("#emailoff").attr("href", "mailto:" +
"?subject=Your ThinOptics glasses" +
"&body=To get your new ThinOptics glasses simply click this link and pick the case and color you like best. You'll get free shipping on your order. \n"+
" WWw.Thinoptics.Com/[email protected] \n" +
"\n Enjoy")
});
\ndoes work in JavaScript. But your problem is that the href gets multilined what you properly wants is to escape the new line so the mail client gets\nand can treat it as\n: TLDR: Use\\nbut the support can differ from client to client.