如何将 coffeescript 与 jquery 一起使用?
how can I use coffeescript with jquery?
我正在使用 CoffeeScript 的 'Koala' 程序。我会用 jQuery 写一个 coffescript。我正在编写以下代码。不工作
$ ->
输出代码
(Function () {
$ (function () {});
}). Call (this);
这在软件中不起作用。我做错了吗?或者如何将 coffeescript 与 jquery 一起使用?
这是一个例子……
HTML
<!DOCTYPE html>
<body>
<a class='button' href='#'>Click Me</a>
</body>
</html>
CoffeeScript
$ ->
$('.button').click (event) ->
console.log 'button clicked'
我正在使用 CoffeeScript 的 'Koala' 程序。我会用 jQuery 写一个 coffescript。我正在编写以下代码。不工作
$ ->
输出代码
(Function () {
$ (function () {});
}). Call (this);
这在软件中不起作用。我做错了吗?或者如何将 coffeescript 与 jquery 一起使用?
这是一个例子……
HTML
<!DOCTYPE html>
<body>
<a class='button' href='#'>Click Me</a>
</body>
</html>
CoffeeScript
$ ->
$('.button').click (event) ->
console.log 'button clicked'