I am new to Javascript programming and I'm trying to learn it by myself. I tried to make a plugin which allows element assigned moving back and forth, but it does not work. Could anyone help me and tell me what the problem with my code? Below is the code with I am trying to develop my plugin.
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<a href="#" style="position:relative">Hello, world</a>
<img src="car.png" style="width:100px; height:60px">
<p>Hello, world</p>
<script src="https://code.jquery.com/jquery-3.1.0.js"></script>
<script>
(function( $ )
{
$.fn.showLinkLocation = function()
{
move();
function move()
{
$(this).animate({left: '500px'}, 1000).animate({left: '0px'}, 1000);
move();
};
};
}( jQuery ));
$( "a" ).showLinkLocation();
</script>
</body>
</html>