S
S
Shamil Khairulaev2021-04-30 19:07:22
AJAX
Shamil Khairulaev, 2021-04-30 19:07:22

How on click to catch the clicked element which is dynamic?

function pagination() {
   const main = $('.main'); //Элемент, в котором будут создаваться объекты, на которые можно нажимать
   const nextPageBtn = main.find('.more-btn');// Элементы, на которые нужно нажимать

   main.on('click', nextPageBtn, function (e) {
      e.preventDefault();
      console.log($(this));
   });
}


How can I intercept on click not main, but exactly the element in the main that was clicked?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question