Example #3: a simple inline click handler

The handler-less version of .on() allows to create small event handlers very easily. In this example the span element is shifted right with each button click.

$('button').on('click').next().css({left:'+=20px'});

Watch me moving!

Other examples with inline attached events