I'm trying to toggle a class on the hover event of an element. The code that I have is
var el = $('[model-id="' + node.id + '"]');
el.hover(
function() {
$(this).toggleClass( "myClass" );
console.log("in",this.getAttribute("class"))
},
function() {
$(this).toggleClass( "myClass" );
console.log("out",this.getAttribute("class"))
}
)
I have the chrome tools elements tab open, and I'm looking at the dom.
When I hover over the element, I get the message
in element Node basic
and when I leave the element, I get
out element Node basic
so you can see on the "in" event, I am getting an appropriate element, and adding the "myClass" class. however, this is not appearing in the dom inspector.
What am I missing ? It must be something obvious ;)