I’m trying to select a div where class= pick1-box given only the ID of a parent using Coffeescript.
jQuery(document).ready ->
pick1value = $('#vote_pick1_id').val
$("#" + pick1value + " .pick1-box").css('background-color', 'green')
I can verify that pick1value has received a value from $('#vote_pick1_id').val
...
<li class='nominee clearfix' id='146'>
<div class='candidate'>
<img alt="Enders" height="80" src="/assets/25803sm.jpg" />
Dick Waddington
</div>
<div class='pick-boxes'>
<div class='pick1-box'>
1
</div>
<div class='pick2-box'>
2
</div>
</div>
</li>
...
FWIW: $("#" + pick1value) doesn’t seem to work either.
This…
should be this…
because you’re not passing arguments.
Right now you’re assigning the function itself to the variable instead of calling it.
Pretty sure your
.css()call could eliminate the()though…