Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

jQuery- Adding Interactivity- arrow

Hello, Thank you for helping me out in advance- I am working on adding interactivity, front end for ruby on rails and am stuck here: $ (args) - $('.status').hover (event) -> $(this).toggleClass("hover")

The lesson says that the arrow should indent some content, and well, nothing happens on mine and nothing is highlighted either (status, this, hover are on the videos). What am I doing wrong? I imported the bootstrap application.js files, or so I think... Help? Thanks.

2 Answers

Hey Alexandra could be a syntax issue try so it appears exactly as below-

$ ->
    $('.status').hover (event) ->
        $(this).toggleClass('hover')

Also, the above is coffeescript, if for any reason you may have removed the .coffee extension on the status.js.coffee file the above will not work. And also as a sanity check make sure you have your classes properly labeled with 'status' in your .html.erb file. jQuery selectors work the same as css selectors so

$(.status).hover

would not work, if in your status/index.html.erb file you had

<div class="statssssus">
  <% @status.each do |status| %>
     <%= status.content %>
  <% end %>
</div>

because the html class and what jQuery is trying to select don't match. Hope this helps.

It does help indeed! Thank you so much- it's working now:) X.