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
Post a Comment