in this var: var previousmenu = $("#ipadmenu section.current").data('order') + 1;, this expression $("#ipadmenu section.current").data('order') equals 0.
Unfortunately the result of this is 01 and not 1. Why is this?
This for example seems to work:
var previousmenu = $("#ipadmenu section.current").data('order') - 1; and gives me -1.
Thank you for your help.
+serves two purposes. It adds in the case of numbers and concatenates in the case of strings. You can fix this by casting the string as a number with this: