What's the issue with this code? It is supposed to animate the arrow from left to right and then back to left again repeatedly, but it's not working as expected. Any ideas on why that might be?
function moveRight(){
$('#myIcon').animate({left: "+=50"}, 1000, function(){
$('#myIcon').animate({left: "-=50"}, 1000, moveRight)
})
}
moveRight();
a{
text-decoration: none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<a href="#" class="btn btn-danger btn-lg">
<span id="myIcon">←</span> Go Back
</a>