Hello
Very new to JavaScript. Fairly simple thing - I would like to increase the value displayed in a box by 1 every time the mouse is clicked on it. Any help with this would be greatly appreciated.
Simon
Hello
Very new to JavaScript. Fairly simple thing - I would like to increase the value displayed in a box by 1 every time the mouse is clicked on it. Any help with this would be greatly appreciated.
Simon
try{
element.innerHTML = (Number(element.innerText) + 1);
}catch (e){
alert(e);
}
Thank you very much - works a treat
I don't know what the catch(e) and alert(e) part is for but doesn't work without it. Lol