Reputation: 51
No idea why this is happening either. First time using JQuery so I'm probably doing a very simple mistake, but if anyone would mind pointing out what I'm doing wrong it'd be greatly appreciated:
<body><div id="content"><h1>Enter.</h1></div>
<script>
$(document).ready(function(){
$("#content").hide(0).fadeIn(3000);
});
$("#content").click(function(){
$("#content").fadeOut(3000).hide(0);
});
</script>
Update: Problem solved in 30 seconds, was just missing a hash in the second part of the code when referring to content. Also modified the code itself to be more effective and achieve the the same effect using less lines of code as suggested by someone else. Thanks for the quick help (and not getting on my case for such a ridiculously simple mistake)!
Upvotes: 0
Views: 62
Reputation: 838
You should move click event in to document ready, and forgot #. Try this
$(document).ready(function () {
$("#content")
.click(function () {
$(this).fadeOut(3000);
})
.hide(0)
.fadeIn(3000);
});
Upvotes: 2