Anonymous Anonymous - 7 months ago
208 0

arrow function access this in event handler https://stackoverflow.com/questions/36915875/javascript-arrow-functions-and-this-selector-in-event-handler

Javascript

arrow functions this inside event handler

dom.videoLinks.click((e) => {
            e.preventDefault();
            console.log($(this));
            var self = $(this),
                url = self.attr(configuration.attribute);

            eventHandlers.showVideo(url);

            // Deactivate any active video thumbs
            dom.videoLinks.filter('.video-selected').removeClass('video-selected');

            // Activate selected video thumb
            self.addClass('video-selected');
        });
Comments