4.Combining .click() and .hover()


#1

https://www.codecademy.com/courses/web-beginner-en-JwhI1/0/4?curriculum_id=50a3fad8c7a770b5fd0007a1#

Hi! What am I doing wrong? I wrote this code and when I click on that, that... KRYPTON, it turns red and vanishes, but hover doesn't work! Is it something with paranthesis, or what?
Please, help me! Thanks!

$(document).ready(function() {
   $('div').click(function() {
   $('div').hover(function() {
     $('div').fadeOut('fast');
     $('div').addClass('red');
});
});
});


#2

your .hover method should be outside of .click event.


#3

Thank youuu! :slight_smile:


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.