I am testing out some functionality and I am trying to make so once I hover on a particular element (in this example any link) it will output something inside the console.
I have looked at this answer -> here where it says "you can define your function once, and it will execute for any dynamically added elements"
So I have this js script but once the elements are loaded dynamically, i.e. like youtube videos, but once I hover on the newly added elements, this script will not work, no output inside the console.
$( "a" ).on({
click: function() {
console.log('clicked');
}, mouseenter: function() {
console.log('enter');
}, mouseleave: function() {
console.log('left');
}
});
Am I missing something here?