G
G
GaserV2015-10-02 13:21:55
JavaScript
GaserV, 2015-10-02 13:21:55

Why doesn't preventDefault() work?

Why doesn't preventDefault() work?

function showPopupOrder(event) {

  event.preventDefault();
  $('body').append('<div class="overlay"></div>').fadeIn("slow");
  $('.popup-order').fadeIn("slow");

}

Uncaught TypeError: Cannot read property 'preventDefault' of undefined

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Korolev, 2015-10-02
@Apathetic

You forgot to pass an event to a function.
onclick="showPopupOrder(event)"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question