Jquery script works in JSfiddle but not on html page

The problem might be, in jsfiddle the script was executed on dom ready (fiddle not working outside the dom ready handler)…. but in your page it doesn’t look like that

In jsfiddle the second dropdown in the LHS panel selects the place where the script will be added, by default it is added as a window.onload handler.

So move the invocation of icon_hover to a dom ready handler

jQuery(function(){
    icon_hover();
})

Demo: Fiddle

Leave a Comment