Stuck on Lesson 12 and I have no idea what's wrong 😕


#1


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


My code looks right to me and it does exactly what the instructions tell me to make it do. But I get this error when I run it:

Oops, try again. It looks like you didn't set your div's opacity to 0.5. Check the example in the instructions if you need help!

Any idea what's wrong?


<html>
	<head>
		<title>Button Magic</title>
        <link rel='stylesheet' type='text/css' href='stylesheet.css'/>
        <script type='text/javascript' src='script.js'></script>
	</head>
	<body>
     <div><br/><strong>Click Me!</strong></div>   
	</body>
</html>

$(document).ready(function() {
    $('div').mouseenter(function() {
        $('div').fadeTo('fast', 1);
    });
    $('div').mouseleave(function() {
        $('div').fadeTo('fast', 0.5);
    });
});


#2

Very wierd, I quickly copied over your code and it seems to work. Try restarting your computer or a different browser as that is the only thing I can see wrong


#3

Remove the semi colon and it should work:

$(document).ready(function() {
$('div').mouseenter(function() {
$('div').fadeTo('fast', 1);
}); <---------------------------------------------- this one
$('div').mouseleave(function() {
$('div').fadeTo('fast', 0.5);
});
});


#4

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