I just started a test project to try out using jQuery. I'm building a site on my hard drive and will later transfer it onto my hosting account. I literally just started and decided I should test out some very basic code to make sure everything was working properly before getting too deep into it. So I put together a little piece of code to make a square div animate 100px to the right when clicked. Of course it didn't work. I can't figure it out. I've tested it on jsFiddle as well, but no luck there either.
Also I've tried putting the code in an external *.js file, in my header, and in the body.
I'm sure there is something very obvious I'm missing, but I'm new to jQuery and javascript.
Any help would be greatly appreciated.
Here is the code:
jQuery:
$(document).ready(function() {
$('div').click(function() {
$('div').animate({left:'+=100px'},500);
});
});
html:
<!DOCTYPE html>
<html>
<head>
<base href="C:\xxx\html\" target="_blank" />
<!--jQuery-->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<!--Stylesheet-->
<link rel="stylesheet" type="text/css" href="stylesheet.css" />
<script type="text/javascript">
$(document).ready(function() {
$('div').click(function() {
$(this).animate({left:'+=10px'},500);
});
});
</script>
</head>
<body>
<div></div>
</body>
</html>
css:
div {
width:50px;
height:50px;
background-color:#444444;
}

















