I have the following HTML:
img class="hoverContact"
img class="hoverContact"
img class="hoverContact"
And the following jQuery:
function highlightContact(ev) {
$(this).addClass('lightblue');
}
$('.hoverContact').mouseover(function(){
highlightContact();
});
Any suggestions?
You’re trying to use
thisinsidehighlightContactwhen the function has no context. Also, the function takes a paramaterevbut you’re not passing it in. Instead, passthisin from the mouseover function and referenceevinstead ofthisin the highlightContact function: