[jQuery] Simple syntax help please!

[jQuery] Simple syntax help please!


I'm trying to set up a 'mailto' href within an existing tag. The tag is set
up to look like this before the jQuery
<a href="#" mLink="partners" mSubject="Partnership Enquiry" mText="Click
to enquire"></a>"
Our site is aliased to several domain names, the main point of the exercise
is to construct the link to reflect the domain name used to reach the site -
but as there are several such links, I'm hoping to generalise the content of
the link elements too, by making it possible to only have to specify the
mailbox, and subject of the mailto in a generic tag. Where the URL host
is 2gc.co.uk, the final tag I'm hoping for looks like this:
<a href="mailto:partnerships@2gc.co.uk?subject=Partnership
Enquiry">Click
to enquire</a>
The code I have to do this right now looks like this:
jQuery('a[mLink="partnerships"]').attr("href","mailto:partnerships@"+window.location.host
+"?subject=Partnership Enquiry").text("Click to enquire");
Clearly what I'd like to do is adjust this code to have the content of the
href to be drawn from mLink, and mSubject. But try as I might, I can't
work out a way to get jQuery to do this. My initial thought was to embed an
attribute request within the main query - kind of like this
jQuery('a[mLink="partnerships"]').attr("href","mailto:"+jQuery(this).attr('mLink')+"@"+window.location.host+"?subject=Partnership
Enquiry").text("Click to enquire")
But this returns 'undefined@..." not "partners@..." - similarly with
attempts to insert the subject text.
I am sure this is easy if you know how. I'd be very grateful for any
assistance from wiser minds on how to achieve what I'm attempting.
Thanks in advance for any help offered.
--
View this message in context: http://www.nabble.com/Simple-syntax-help-please%21-tp19100091s27240p19100091.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.