I have two links a with classes .next-button-1 and .prev-button-1 and when I click on the buttons is calls different functions
$('.next-button-1').click(function (e) {
e.preventDefault();
e.stopPropagation();
gotoNext();
});
$('.prev-button-1').click(function (e) {
e.preventDefault();
e.stopPropagation();
gotoPrev();
});
The performing of each function takes some time. Is there any way to make the button could not click until the function is executed?
upd
I have found the solution:
$('.next-button-1').click(function (e) {
e.preventDefault();
e.stopPropagation();
if ($(this).hasClass('disabled'))
return false;
else {
$(this).addClass('disabled');
gotoNext();
}
});
$('.prev-button-1').click(function (e) {
e.preventDefault();
e.stopPropagation();
if ($(this).hasClass('disabled'))
return false;
else {
$(this).addClass('disabled');
gotoPrev();
}
});
and I remove class 'disabled'
$('.next-button-1').removeClass('disabled'); in gotoNext() function
and
$('.prev-button-1').removeClass('disabled'); in gotoPrev() function