In this Jquery tutorial, We will see that how to disable click event using jquery.Many of us face the same issue which is the multiple form submission when the user clicks twice when we submit form data using ajax.So we need to use Jquery Disable button on click to stop multiple form submission So Now I will show you a method to fix this issue. This will also help you to stop duplicate entry in your database.
We can simply use jQuery off() method. JQuery off() method is used for removing the click event handler from the button attached with the on() method. Use off() method after click event is triggered to disable element for the further clicks.
Jquery Disable Button
Let’s take an example of Jquery disable button on click when submitting a form. so we can understand clearly.
<p> Jquery Disable Button </p>
alert("Click Button is Disabled");
alert('You Just Click');
In above example, I created two button Click and Disable. When you click on Click button it’ll show you a popup alert message But if we click Disable button it’ll disable click event on Click button and popup alert will not display.Until the page will be refreshed. we are using googleapis link which is used for jquery. We put ready function and put click event on disable button and click the button using their id attribute. We use on function in this example.
As you can see that how we achieve this using jquery. If you have any query related to this post then feel free comment on the comment box and don’t forget to share this post on Facebook and another social media. And don’t forget to like on Facebook Page.