4

So I want to be able to tell when a html button is no longer clicked/touched so I can change a boolean from true to false.

<input id="clickMe" type="button" value="Click to start." onclick="playIt();" />

I way to see if it's currently still pressed would work as well.

Max Desiatov
  • 5,087
  • 3
  • 48
  • 56
MickDom
  • 157
  • 2
  • 12

1 Answers1

4

Just add an onmouseup to your button:

<input id="clickMe" type="button" value="Click to start." onmouseup="playIt();">
statosdotcom
  • 3,109
  • 2
  • 17
  • 40
  • Thanks, worked easy enough and if it doesn't work on some mobile devices I'll just have to do the same for touchstart and touchend. – MickDom Apr 22 '16 at 01:22
  • I think this will do on any browser, cause it's been part of HTML specification for a long time. Thank you for your return. – statosdotcom Apr 22 '16 at 01:28