Without using class, how can I apply a simple css rule on a data attribute that gets dynamically added? Here's my current solution with classes, I want to replace this with adding data, and apply the css rule to elements with data attribute 'highlight'. Is this possible? The reason I am doing this is to avoid messing with the underlying DOM data.
$(document).on('mouseover',function (e) {
e.stopPropagation();
$(e.target).addClass('highlight');
}).on('mouseout', function (e) {
e.stopPropagation();
$(e.target).removeClass('highlight');
});
mouseout, am I right?