Hi Sean, Thanks for the reply. Let me see if I can break this code down, just for my own learning purposes:
<a href="mailto:">user [AT] domain [DOT] com</a> $(function(){ Not sure why you had to declare the function this way. ??? $("[EMAIL PROTECTED]'mailto:']").each(function(){ So grab every anchor tag that has the string "href='mailto:'" in it and for each element returned: var str = $(this).html().replace("[AT]","@").replace("[DOT]",".").replace(/\s+/g,""); replace the innerHTML attribute of the element with the [AT] replaced by an "@", [DOT] replaced by a "." and a regex to remove the spacing. Return all of that into the variable "str". $(this).attr("href",str).html(str); }); Set the value of "href" in the anchor tag to the value of str and also set the innerHTML of the anchor tag to the same value (basically the email address. }); Am I on the right track? Also, an example of Ajax calls that sends form values to the called routine would be awesome. Rey... sunsean wrote: > I think one of the niceties of jQuery is it's ability to compact code. > That's about the only "good practice" I follow. Let me analyze a > simple jQuery snippet for you to look at. > > Lets say we have the following code: > <a href="mailto:">user [AT] domain [DOT] com</a> > > And we want to turn it into this: > <a href="mailto:[EMAIL PROTECTED]">[EMAIL PROTECTED]</a> > > Here is an example: > $(document).ready(function(){ > $("a").each(function(){ > if($(this).attr("href")=="mailto:") { > var str = $(this).html(); > str = str.replace("[AT]","@"); > str = str.replace("[DOT]","."); > str = str.replace(/\s+/g,""); > $(this).attr("href",str).html(str); > } > }); > }); > > > Well that works, but this would be better: > $(function(){ $("[EMAIL PROTECTED]'mailto:']").each(function(){ > var str = > $(this).html().replace("[AT]","@").replace("[DOT]",".").replace(/\s+/g,""); > $(this).attr("href",str).html(str); });}); > > I hope that helps, let me know if you have any specific examples you > want me to go over. > > ~Sean > > _______________________________________________ > jQuery mailing list > discuss@jquery.com > http://jquery.com/discuss/ > _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/