Anurag Singh
Anurag Singh

Reputation: 727

Unable to hide div element using Jquery

In my code i am trying to hide a div element which contains a image, but when i run the code i get - ReferenceError: jQuery is not defined })( jQuery ); in the file jquery-ui.js (line 314). My code is given below

<!DOCTYPE html>
<html>
<head>
    <title>Sliding a div</title>
    <script type="text/javascript" src="plugin/ui/jquery-ui.js"></script>
    <script type="text/javascript" src="plugin/jquery-1.9.1.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            $('#1').click(function(){
                console.log("i am inside");
                $('#element').hide('slide',{direction:'left'},1000);
            });
        });
    </script>
</head>
<body>
<div id="headder" style="width: 1300px; height: 100px">
    <h1>Slide the div</h1>
</div>
<div id="element" style="width: 600px; height: 400px; border: 2px solid red; position: relative">
    <img src="images/aa.jpg" width="600" height="400">
</div>
<div id="control" style="position: relative">
    <input type="button" id="1" value="PRESS">
</div>
</body>
</html>

Please let me know the reason behind this.

Upvotes: 0

Views: 518

Answers (1)

George
George

Reputation: 36784

You need to reference jQuery before jQuery UI:

<script type="text/javascript" src="plugin/jquery-1.9.1.js"></script>
<script type="text/javascript" src="plugin/ui/jquery-ui.js"></script>

Upvotes: 8

Related Questions