引数marketを関数freeSampleに渡したい関数がありますが、引数として設定できないようです。私のコードを見て、freeSample関数の引数としてマーケットを取得する方法を理解するのを手伝ってください。
(freeSample) ->
market = $('#market')
jQuery('#dialog-add').dialog =
resizable: false
height: 175
modal: true
buttons: ->
'This is Correct': ->
jQuery(@).dialog 'close'
'Wrong Market': ->
market.focus()
market.addClass 'color'
jQuery(@).dialog 'close'
更新:これが私が現在持っているJavaScriptで、CoffeeScriptに変換しようとしています。
function freeSample(market)
{
var market = $('#market');
jQuery("#dialog-add").dialog({
resizable: false,
height:175,
modal: true,
buttons: {
'This is Correct': function() {
jQuery(this).dialog('close');
},
'Wrong Market': function() {
market.focus();
market.addClass('color');
jQuery(this).dialog('close');
}
}
});
}