Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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.