Try this I assume you used the word trigger NOT in a jQuery sense http://docs.jquery.com/Events/trigger#typedata
jQuery(function($){ //document load/ready myHandler(); $('#button').click(myHandler); }); This code runs myHandler on document load. The code runs myHandler when #button is clicked. On Dec 15, 7:07 pm, Dave Methvin <dave.meth...@gmail.com> wrote: > You can bind the same handler to multiple events. It sounds like you > are trying to "fake click" the button right after load to initialize > things. I do that a lot. > > $(document).ready(function(){ > > $('#mybtn').bind('click init', function(e){ > alert("called because of "+e.type); > }).trigger("init"); > > }); > > You could also use .triggerHandler("click") instead, but I prefer to > make it clear the call is because of initialization.