D
D
doroshenko_magic2018-06-09 18:52:14
JavaScript
doroshenko_magic, 2018-06-09 18:52:14

Can jQuery be converted to pure JavaScript?

For example, this code?

$(".hover").mouseleave(
  function() {
    $(this).removeClass("hover");
  }
);

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Spirin, 2018-06-09
@doroshenko_magic

Can. After all , jQuery is a JavaScript library .

document.querySelectorAll('.hover').forEach(function(el) {
  el.addEventListener('mouseleave', function() {
    this.classList.remove('hover');
  });
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question