Unexpected token / character

Hi guys,
I was trying to apply the animation of sliding up by applying a less margin in javascript, but it is saying that my margin can not be negative err or what the error actually says is that the negative symbol - is an unexpected token.
Here is my code:

<script type="text/javascript">
	$("#followMe").hover(
  		function () {
    		$("#followMe").animate({margin-top:-128}, 600);
  		}, 
  		function () {
   			$("#followMe").animate({margin-top:-113}, 600);
  		}
	);
</script>

I was hoping that someone could help me fix?
Is there an escape character or something that I can use?

Thanks in Advance and I hope to hear from you soon,
Team 1504.

Try specifying it as “-113px” instead of -113 (including quotation marks).

thank you for replying quickly.

Unfortunately, Chrome still says that there is an Unexpected Token Error for ‘-’ even with the quotation marks.
Here is the code in case you can think of any other solutions:
<script type=“text/javascript”>
$(“#followMe”).hover(
function () {
$(“#followMe”).animate({margin-top:“-128”}, 600);
},
function () {
$(“#followMe”).animate({margin-top:“-113”}, 600);
}
);
</script>

Thanks in Advance,
Team 1504

… duh. After looking at the code more closely I realized it’s the - in margin-top that’s causing the issue, not the one on the number.

You need to do “margin-top”.

You also need to put px with your number. It’s different from style.marginTop. It’s the same as when you do regular CSS, you can’t omit px.

Javascript maps need to be done like {“key”: “vlaue”}.

Thank you very much! That worked perfectly :slight_smile: