$ ->
  console.log("DOM is ready")
$(".submit").click ->
  console.log("submitted!")
$(".button").on "click", -> console.log("button clicked!")
$(document).on "click", ".button2", ->
  console.log("delegated button click!")
$.ajax
 url: "some.html"
 dataType: "html"
 error: (jqXHR, textStatus, errorThrown) ->
  $('body').append "AJAX Error: #{textStatus}"
success: (data, textStatus, jqXHR) ->
  $('body').append "Successful AJAX call: #{data}"
$.ajax
url: "some.html"
dataType: "html"
error: (jqXHR,
textStatus, errorThrown) ->
  $('body').append "AJAX Error: #{textStatus}"
success: (data, textStatus, jqXHR) ->
  $('body').append "Successful AJAX call: #{data}"

div.animate
 color: red 2000 ->
 doSomething()

div.animate {width: 200}, 2000
div.animate width: 200 height: 200 2000

$("input")
.val("")
.css 'z-index': 5
.removeClass "fart"

$(".button").click ->
  setTimeout ( =>
    $(@).slideUp()
  ), 500

 

Source: https://css-tricks.com/jquery-coffeescript/