У меня есть следующий код:
HTML:
JavaScript:
$('.tombol-acc').on('click', function(e) {
e.preventDefault();
const href = $(this).attr('href');
Swal.fire({
title: 'Are you sure?',
text: "You won't be able to revert this!",
type: 'warning',
showCancelButton: true,
confirmButtonColor: '#3085d6',
cancelButtonColor: '#d33',
confirmButtonText: 'Yes, delete it!'
}).then((result) => {
if (result.value) {
document.location.href = href;
}
})
});
но когда я щелкаю элемент, это не мешает действию по умолчанию.Почему?