JQuery events lesson four...click and hover error


#1

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

});
})

This is the code I used to explode Krypton. Krypton turns red when you drag over it and then disappears (explodes) I am given an error that says Krypton is still green....don't understand why

Don

Replace this line with your code.

`


#2

@donkvash,
Please read
https://www.codecademy.com/en/forum_questions/50bdf776fda6736385002b9b

In short
the =click= Eventhandler
and the =hover= Eventhandler
should be separated Eventhandler

As you have it now
you have integrated the =hover= Eventhandler
into the =click= Eventhandler !!!


#3

How would I separate them?
Don


#4

I just figured it out...i removed the click function altogether and itworked.

Thanks

Don


#5

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