Fiddle - http://codepen.io/mikethedj4/pen/BNRdVp
Today I decided to learn Coffeescript and play around making some functions, handling events, etc.
However today I got an error that says, "reserved word 'function'", and haven't figured out how to solve it.
Original:
$(function () {
function download_to_textbox(url, el) {
$.get(url, null, function (data) {
el.val(data);
}, "text");
}
download_to_textbox("http://code.jquery.com/jquery-latest.min.js", $("textarea"));
});
My translation:
(($) ->
function download_to_textbox(url, el) {
$.get(url, null, (data) ->
el.val(data);
}, "text");
}
download_to_textbox("http://code.jquery.com/jquery-latest.min.js", $("textarea"));
$("textarea").click ->
$(this).select();
) jQuery
functionkeyword in CS.