Learning jQuery but nothing happens?

I'm trying to use jQuery, but for some reason nothing happens when I click the button. I've tried manipulating the code in different ways, but nothing happens

I am using Firefox and javascript works fine.

Here's my code:

<!DOCTYPE html>
<html>
<head>
    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>
    <style>
        body {
            background-color:royalblue; 
            margin:0px;
        }

        #div_header {
            background-color:black;
            height:200px;   
        }
    </style>

    <script type="text/javascript">
        $(document).ready(function() {
            $("button").click(function() {
                $("#div_header").hide();
            });
        });
    </script>
</head>
<body>
    <div id="div_header">
        <button type="button">Click me!</button>
    </div>
</body>
</html>

      

+3


source to share


1 answer


The script source value is incorrect. Change it to



<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script>

      

+5


source







All Articles