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


#1


Error message is: Oops, try again. It looks like Krypton is still green! Check the Hint if you need help.

I clicked the help button and the syntax is the same.


$(document).ready(function() {
    $('div').click(function() {
        $(this).fadeOut('fast');
    });
});

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


#3

Put this in the document.write.


#4

The whole thing inside document.write? You're gonna have to explain why that makes sense because the editor wouldn't take it.


#5

I think your

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

Should be inside of your

$(document).ready(function() {
});

If you need more help, please provide a link to the lesson.


#6

Try do this:

...

$('div').hover(function(){
   $(this).addClass('red');
});

...

And, put this code inside of ready function.


#7

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