Well I'm having the following problem. JQuery identifies the data-link
tag to retrieve the link and redirect the page. Soon after that the booting has to be disabled.
The problem is that clicking the button is disabled and is not redirected.
How do I get it disabled later? This is to avoid double-clicking.
$("body").on('click', '[data-link]', function() {
console.log($(this).data('link'));
// Verifica se tem link
if (typeof $(this).data('link') !== 'undefined') {
document.location.href = $(this).data('link');
}
});
$(document).ready(function () {
// verificação de clieque
$("button").click(function () {
if(!$(this).disabled){
// Desabilita o botao
$(this).prop('disabled', true);
}
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><buttontype='submit'data-link="http://www.google.com">OK</button>
<br>
<Br><br><br>
<div data-link="http://www.google.com">OK</div>