Let's say there is a button (ADD BUTTON) to add a blog. Adding is done when the user clicks on this button. But when you click the button several times, a few records are created. To prevent this, I did the method with the javascript below. Do you think this method works fully?
$(function(){
$('form').on('submit', function () {
$(this).find(':submit').attr('disabled', 'true');
})
});
When I make this code based on id and classes, user can intervene yes. When I make this code based on ids and classes, user can intervene yes. But when I write just as above, when the user intervenes in the code, either the form submission is active and it is run in a healthy way.
$(function(){
$('.form-prevent').on('submit', function () {
$('.btn-prevent').attr('disabled', 'true');
})
});