Skip to content Skip to sidebar Skip to footer

Javascript Event Still Firing Even When Class Name Doesn't Exist

Can someone explain to me how an event would fire when a class name it's targeting doesn't exist.. CODE (function ($) { var config = {}; $(document).ready(function () {

Solution 1:

Use event delegation in jquery. you dynamically add the class .dosomething

$('body').on('mouseenter mouseleave', '.dosomething .email-signup__wrap' , function(ev) {

Post a Comment for "Javascript Event Still Firing Even When Class Name Doesn't Exist"