views:

36

answers:

1

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>
+1  A: 

You can use the encodeURIComponent (just a plain JS function, not related to jQuery):

<a href="mailto:'+encodeURIComponent(email)+'">Email me</a>
reko_t
Perfect, thank you.
danixd