i want to prevent my users from double clicking on submit button. Can some one tell me how to prevent it for & in HTML
Asked
Active
Viewed 1,273 times
-2
-
Use `.one()` if you only want the event to trigger once or define a flag that prevents a submit button click until the previous click has been processed (validation, ajax etc). – Joe Apr 06 '15 at 15:43
1 Answers
0
If you're just trying to prevent an action when a user double clicks, use the .dblclick()
function.
$("submit").dblclick(function(e) {
e.preventDefault();
});
If you're trying to make it so that a form is only submitted the first time the button is pressed, then use the .one()
function somewhat like this:
$("submit").one("click", function(){$("#yourformid").submit();$(this).attr("disabled","disabled");});

IronFlare
- 2,287
- 2
- 17
- 27