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 [email protected] http://jquery.com/discuss/
