L
L
Leonard Tesnov2018-07-13 20:07:50
JavaScript
Leonard Tesnov, 2018-07-13 20:07:50

Why does it fire twice when using click with on()?

$(document).on("click", "#button", function(){
  alert("alert");
});

There is such a code, when you click on #button alert is displayed twice.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
Anton Spirin, 2018-07-13
@limzikiki

I think this is the reason .

Y
yakupov112, 2018-07-13
@yakupov112

https://codepen.io/anon/pen/EpVQmB 1 time output

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question