Javascript examples for DOM HTML Element:Input Button
Change number every time when clicking
<html lang="en"> <head></head> <body translate="no"> <center> <span id="timesClicked">0</span> </center> <button type="button" class="btn btn-default" onclick="javascript:btnClick()">Click</button> <script> var timesClicked = 0;// w w w . ja v a 2 s. c om function btnClick(){ timesClicked ++; document.getElementById('timesClicked').innerHTML = timesClicked; return true } </script> </body> </html>