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

Building A Rails App - Adding Interactivity

When I'm writing the code for the hover event,

 $ -> 
    $('.status').hover (event) -> 
      console.log("Hover triggered")

I get the heading in the console but I get no actual reaction to the code.

9 Answers

ADD A SEMICOLON AT THE END.

fixed.

The only thing that bit of code does is it displays "Hover triggered" in the console, when you over over something with a class of "status". If you are seeing this in the console it is working.

Thanks Jody,

So what is causing the hover event to not actually work?

When I'm hovering over the statuses, edit and delete do not appear

The relevant code should be

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

If you have the matching CSS it should appear.

I do have the matching CSS because if I inspect the element and edit it by adding hover class in in the <div class = "status"> it shows the edit and delete options

Have you downloaded the project files and looked at them?

Yes and everything is matching.

Maybe Jason or Jim could take a look at this.

Jason Seifer
STAFF
Jason Seifer
Treehouse Guest Teacher

Try using the mouse enter and mouse leave events separately. I've always found hover to be kind of buggy.