Naren Singh
Naren Singh

Reputation: 347

JQuery, div displayed but does not fade

I'm a newbie here and trying to run my first jQuery program. The code works fine on JsFiddle, however - when I try to run it in my browser the div is displayed but it won't fade. Can you please help? Am i referencing the jQuery libraries correctly? I have also create separate files for html, css and script in the same folder. Thanks in advance.

HTML file -

<head>
    <title>Result</title>
    <link rel='stylesheet' type='text/css' href='stylesheet.css'/>
    <script type='text/javascript' language='Javascript' ``src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js"></script>
</head>
<body>
    <div></div>   
</body>

Sylesheet -

div {
    height: 100px;
    width: 100px;
    background-color: #FA6900;
    border-radius: 5px;
}

and the script -

$(document).ready(function() {
    $('div').click(function() {
        $('div').fadeOut('slow');
    });
});

Upvotes: 0

Views: 121

Answers (1)

Black Sheep
Black Sheep

Reputation: 6694

Here the DEMO (It works fine)

You have to link to jQuery library, like this:

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

Upvotes: 1

Related Questions