I am trying to write a code that set CSS for some dynamic elements added on click on a link.
As per the example code in CoffeeScript tutorial it should be working with the following code.
temp = temp+1
$ '.box_'+temp
.css 'background', 'white'
Here temp
is a variable integer.
I tried with static values like
$ '.box_1'
.css 'background', 'white'
but it returns something like this with .css not a function error
$('.box_1'.css('left', 100));
$('.box_' + temp).css('background', 'white');
and$('.box_1').css('background', 'white');
. (version 1.8.0)$(".box_#{temp}").css('background', 'white')
or$(".box_#{temp}").css 'background', 'white'
are perfectly good CoffeeScript. Code is supposed to be readable, if you have to spend more than a second parsing the syntax then the code is effectively broken..box_1