V. Snow
V. Snow

Reputation: 133

Simple but so far unsolveable: Why doesn't my click function work? (Jquery)

<script src='jquery-3.2.1.min.js'>
$(document).ready(function(){
    $("#enterbutton").click(function(){$("#curtain").fadeOut(1000);});
    }
</script>

When I run my page in any browser, the click function doesn't work. I can click all over and around the element, but nothing happens.

I have already tried putting the code in the jquery file instead, and I have tried using the .on('click', method instead of .click.

Upvotes: 0

Views: 38

Answers (1)

Mohamed-Yousef
Mohamed-Yousef

Reputation: 24001

close script

<script src='jquery-3.2.1.min.js'></script>
<script>
   $(document).ready(function(){
     $("#enterbutton").click(function(){
        $("#curtain").fadeOut(1000);
     });
   });
</script>

if you already have jquery-3.2.1.min.js file the above code should work good but if you don't have the source file of jquery you can use

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script>
    $(document).ready(function(){
       $("#enterbutton").click(function(){
          $("#curtain").fadeOut(1000);
       });
    });
 </script>

Upvotes: 3

Related Questions