May 13, 2014 06:03 pm GMT
Original Link: http://css-tricks.com/jquery-coffeescript/
jQuery with CoffeeScript
I don't always write CoffeeScript, but when I do, I'm probably using jQuery too I always forget the syntax for stuff. So I'm going to write it all down here so I can reference it until I memorize it.
Note that the compiled example doesn't include the automatic closure around everything you get in CoffeeScript.
Safe jQuery Closure
So you can use the $ safely (common in WordPress):
(($) ->
) jQuery(function($) {
})(jQuery);
DOM Ready$ ->
console.log("DOM …
jQuery with CoffeeScript is a post from CSS-Tricks
Original Link: http://css-tricks.com/jquery-coffeescript/
Share this article:
Tweet
View Full Article