instead, it must to be something like $.makemailto({opts})
read this http://snook.ca/archives/javascript/jquery_plugin/
----- Original Message -----
From: "ElJayWilson" <eljaywil...@gmail.com>
To: "jQuery (English)" <jquery-en@googlegroups.com>
Sent: Wednesday, August 19, 2009 1:54 PM
Subject: [jQuery] Simple Plugin for jQuery
I am trying to get a handle on creating a jQuery plugin. I have a
function that I wrote a couple of years ago that returns a formatted
email address. I want to turn that function into a jQuery plugin.
Here is my function:
[code]
function makemailto(email,subject,text)
{
// Makes a nice mailto link
var returnval;
returnval = '<a href="mailto:' + email +
'?">' + email + '</a>';
if (subject && text)
{
returnval = '<a href="mailto:' + email +
'?subject=' + subject +
'&">' + text + '</a>';
}
else if (subject)
{
returnval = '<a href="mailto:' + email +
'?subject=' + subject +
'&">' + email + '</a>';
}
else if (text)
{
returnval = '<a href="mailto:' + email +
'?">' + text + '</a>';
}
return(returnval);
}
[/code]
I cannot seem to figure out how to create a simple plugin that I can
call like this:
$.makemailto('some...@somewhere.com','Subject Here');
Any advice?
Thanks,
LJ Wilson