1

I have this simple coffescript

$(document)
   .ready -> $('body') .css -> 'background-color':'black'

it's compile to

(function() {
  $(document).ready(function() {
    return $('body').css(function() {
      return {
        'background-color': 'black'
      };
    });
  });

}).call(this);

after that i have some console error no method 'replace', what is wrong? Much thx for help.

Lukas
  • 7,384
  • 20
  • 72
  • 127
  • It looks like you are using jQuery incorrectly - what are you trying to do? – Justin Ethier Jun 28 '13 at 14:59
  • The shorthand for `$(document).ready ->` for jQuery is just `$ ->` - see http://api.jquery.com/ready/ and http://stackoverflow.com/questions/6004129/document-ready-shorthand – Wex Jun 28 '13 at 15:56

1 Answers1

2

Change your CS to

$(document)
   .ready -> $('body') .css 'background-color':'black'

So that the argument passed to css is {'background-color': 'black'} instead of a function.

Denys Séguret
  • 372,613
  • 87
  • 782
  • 758