Paul Paul - 1 year ago 79
Javascript Question

event click firing on page load

beginner question with javaScript and jQuery. I can post the html if necessary. I have a div with an id of "container" that when clicked should make a text div with id of "text" appear. So my javaScript code so far:

$(document).ready(function (){

The problem is that the fading happens when the page loads. Can someone explain why? Many thanks,


Answer Source

Pass function to click:

$(document).ready(function (){
   $("#container").click(function() { $("#text").fadeIn(500) } );
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download