Reputation: 7445
Simple question really, I am relatively new to both jQuery and XML.
I just want to pull an email address into a link, but unsure how I am escaping the quotations.
<a href="mailto:'+email+'">Email me</a>
The +email+ is being taken from an XML file with code like this: <email>[email protected]</email>
so I want the HTML to look like:
<a href="mailto:[email protected]">Email me</a>
Upvotes: 0
Views: 253
Reputation: 56440
You can use the encodeURIComponent
(just a plain JS function, not related to jQuery):
<a href="mailto:'+encodeURIComponent(email)+'">Email me</a>
Upvotes: 1