// stuff right here will run immediately $(document).ready(function() { // anything in here will only // run when the page first loads }); // stuff right here will run immediately
jQuery Event Object Normalizes event object across browsers. Guaranteed to be first argument to every bound function. http://docs.jquery.com/Events/jQuery.Event
$('a').bind('click', function(event) { event; }); $('a').bind('click', function(evt) { evt; }); $('a').bind('click', function(e) { e; }); Name it whatever you want, these are the common ones. event, evt, e
click Binds a function to the click event of each matched element http://docs.jquery.com/Events/click#fn http://teaching.johnnunemaker.com/capp-30550/examples/click-event/
$('#foo').click(function(event) { alert('foo was clicked!'); }); $('#foo').bind('click', function(event) { alert('foo was clicked!'); }); These are the same thing
double click Binds a function to the double click event of each matched element http://docs.jquery.com/Events/dblclick#fn http://teaching.johnnunemaker.com/capp-30550/examples/double-click-event/
keypress Binds a function to the keypress event for each matched element http://docs.jquery.com/Events/keypress#fn http://teaching.johnnunemaker.com/capp-30550/examples/keypress-event/
mouseover/mouseout Bind a function to the mouseover or mouseout event of each matched element. http://docs.jquery.com/Events/mouseover#fn http://docs.jquery.com/Events/mouseout#fn http://teaching.johnnunemaker.com/capp-30550/examples/mouseovermouseout/
mousemove Bind a function to the mousemove event of each matched element. http://docs.jquery.com/Events/mousemove#fn http://teaching.johnnunemaker.com/capp-30550/examples/mousemove-event/
scroll Bind a function to when document view is scrolled http://docs.jquery.com/Events/scroll#fn http://teaching.johnnunemaker.com/capp-30550/examples/scroll-event/