Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8097033
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:37:50+00:00 2026-06-05T21:37:50+00:00

These are for two separate codecademy exercises. They both pass me but I’m not

  • 0

These are for two separate codecademy exercises. They both pass me but I’m not getting the result I’m supposed to.

3.2 – Mouse Events – Question

Write a hover handler and attach it to all divs. In the first function add the class “hover” to the current object we are hovering over, and in the second remove the class “hover”. We have already learned how to do this by passing the event object, but this time let’s try another way by using $(this).addClass(). Though, you can try events if you would like!

When you are done the green boxes should pop out and turn blue as the user hovers over them.

3.2 – Mouse Events – Answer

$(document).ready(function(){
    $('div').hover(function() {
        (this).addClass('hover');
    },
    function() {
        (this).removeClass('hover');
    });
});

3.3 Keyboard Events – Question

keypress is formatted exactly like the click handler.

Write a keypress handler that appends a div with class “box” to the div with id = “boxDiv”. Attach the keypress handler to the body of the document.

3.3 Keyboard Events – Answer

$(document).ready(function(){
    $("body").keypress(function(event){
        $('#boxDiv').append($("<div/>").addClass('box'));
    });
 });

If you’d like further clarification here’s a direct link to the course.
http://www.codecademy.com/courses/jquery-events/2#!/exercises/1

Thanks in advance!

Regards,

Matt

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T21:37:51+00:00Added an answer on June 5, 2026 at 9:37 pm

    Regarding mouse events, there’s a minor syntax error:

    (this).addClass('hover'); and (this).removeClass('hover');
    

    are missing leading dollar signs. They should be:

    $(this).addClass('hover'); and $(this).removeClass('hover');
    

    As far as the keyboard test, it should work. When you run it, try clicking in the result area before pressing a key.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

We have two separate web-apps, say 'retailUI' and 'bulkUI'. These two are basically two
I have these div blocks called columns where each column div contains separate two
These two files are mostly seen in open source projects. What are they for,
These two querys gives me the exact same result: select * from topics where
So these two methods have the same signature but different constraints public static void
i have a string of the format ABCDEFG,12:34:56:78:90:11. i want to separate these two
I have two separate SELECT statements which are both GROUP-BY'd separately e.g.: SELECT x,
i have 2 tables(result of two separate SQL queries and this result will be
Why did MS originally make the decision to maintain these two separate core libs?
Assume there are two separate web applications: a sports site with admin backend an

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.