Unicorns are a mythical creature, and so is that use of parentheses. Could this be the syntax you were looking for?
(function() { var $ = window.jQuery; $("#CollapseExpandTd").click( function() { $("#TreeviewTd").toggle(); $("#MenuBarTd").toggle(); }); })(); That puts all the code inside a function, and then immediately calls the function. Now you have all the unicornish magic you were looking for, without the mythical aspects. :-) -Mike On Tue, Dec 22, 2009 at 8:06 PM, Leonardo Balter <leonardo.bal...@gmail.com>wrote: > Nah, make it sexier, use parenteses (tip from the new John Resig's ebook): > > ( var $ = window.jQuery; > $("#CollapseExpandTd").click( > function() { > $("#TreeviewTd").toggle(); > $("#MenuBarTd").toggle(); > }); > ); > > $ will be a local variable and unicorns will come to see the magic running > around. > > 2009/12/23 jqHunter <tinu.punn...@gmail.com> > > Thanks much Sime Vidas, it worked! Since mine is an aspx with an AJAX >> UpdatePanel, jQuery(document).ready(function(){...}); did not work for >> me. So I implented it in the pageLoad as below: >> >> jQuery.noConflict(); >> function pageLoad() { >> jQuery("#CollapseExpandTd").click(function() { >> jQuery("#TreeviewTd").toggle(); >> jQuery("#MenuBarTd").toggle(); >> }); >> } >> >> Thanks again! >> > > > > -- > At, > Leo Balter > http://leobalter.net > Blog técnico: http://blog.leobalter.net > >