Valeria Melinte
Valeria Melinte

Reputation: 137

jQuery animate not working / no errors

I have this simple jQ script

$(document).ready(function(){
    $('#click').on('click', function(){
        $('#slide').animate({left: "100px"});
    })
});

and the HTML

<div id="slide" style="border:2px solid red; width:100px; height:100px; background-color:blue; position:relative; left: -100px;">

</div>
<button id"click">click</button>

The div doesn't slide and I can't figure out what the problem is

Upvotes: 0

Views: 73

Answers (1)

Tahir Ahmed
Tahir Ahmed

Reputation: 5737

I see a problem in your button line in HTML. Currently it is:

<button id"click">click</button>

But it should be:

<button id="click">click</button>

There should be an = sign in between id and its value. Other than that, everything else look fine to me. Have you made sure that your jQuery is included?

Here is a jsFiddle demo.

Upvotes: 3

Related Questions