Combining .click() and .hover()


#1


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

My code works, but I was confused. I didn't get, how does this exercise demonstrate the combining of .click() and .hover() events. They have been written separately?!


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

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


#2

combining here simply means a div (the same div) can have multiply events (click and hover)


#3

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