javascript - How to get alert message on second click of a button -


i know how can alert message on second click of button, not on first click.

ex: <input type="button" value="message" onclick="showmessage()">

function showmessage(){     alert("it's second click message"); // alert message should shown on second click of button } 

use counter instead..

var count = 0; //global variable  function showmessage() {    if (count++ == 1) { //compare , increment counter      alert("it's second click message"); //this alert message shown on second click of button    }  }
<input type="button" value="message" onclick="showmessage()">


Comments

Popular posts from this blog

java - Date formats difference between yyyy-MM-dd'T'HH:mm:ss and yyyy-MM-dd'T'HH:mm:ssXXX -

python - RuntimeWarning: PyOS_InputHook is not available for interactive use of PyGTK -