I have a button on my page. I don't want to do any operation if the user clicks on the button for second time. I have the following code. But it is not working. Can someone help??
$("#myButton").click(function(){
var count = 0;
count++;
alert("button");
if(count>1)
$('#myButton').prop('disabled', true);
});
<button type="button" id="myButton" > Click Me </button>
This is the FIDDLE
you can use one in jquery for that
$("#myButton").one("click",function(){
It will attach a handler to an event for the element which will executed at most one.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments