It is also possible to have the best of both worlds: no parentheses, for example, in response to @genericdave and nice formatting, as in @ Domenic's. You will have to use the line break character: \
.
When working with single line:
$('#target').toggle \ -> alert "First handler for .toggle() called.", -> alert "Second handler for .toggle() called."
When accessing callbacks that contain more than one line of code:
$('#target').toggle \ -> alert "1st handler. First line" alert "1st handler. Second line" ,-> alert "2nd handler. First line" alert "2nd handler. Second line"
source share