Когда я нажимаю на элемент, это не мешает действию по умолчанию - PullRequest
0 голосов
/ 07 апреля 2019

У меня есть следующий код:

HTML:

href code

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;
    }
  })
});

но когда я щелкаю элемент, это не мешает действию по умолчанию.Почему?

...