2
Well I’m having the following problem. jQuery identifies the tag data-link
to recover the link and redirect the page. Soon after this the boot has to be disabled.
The problem is that by clicking the button it is disabled and is not redirected.
How do I disable it only later? This and to avoid a double click.
$("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>
<button type='submit' data-link="http://www.google.com">OK</button>
<br>
<Br><br><br>
<div data-link="http://www.google.com">OK</div>