I’m struggling to get the numeric content of a variable to hypeDocument.getElementById(id).innerHTML…
If I pass a letter it works, but a number results in a NaN…I know it must be something simple I’m doing wrong but my limited javascript knowledge is holding me back.
Can someone please help me on my way?
I’m just trying to increment a number on the display of a UI demo…
Here is the code that I’m calling from a scene-keypress-action (‘level’ is the ID of the 2 digit number I want to increase). Ultimately I’d like to use the arrow keys to both increase and decrease as well as have it rund faster the longer i depress the key…but first I just want to work.
Thanks
anders
var l = hypeDocument.getElementById('level').innerHTML;
l = Number(l) + 1;
hypeDocument.getElementById('level').innerHTML = l;