javascript - Trouble with jquery .hover function -


having issue jquery .hover function. able work if wrap in generic $(function(){ have seen done without needing generic function, if can see doing wrong appreciate it.

this not work:

$('#slider > img').hover(function () {     stoploop(); }, function () {     startslider(); }); 

this work:

$(function () {     $('#slider > img').hover(function () {         stoploop();     }, function () {         startslider();     }); }); 

simple answer trying bind events tags while not exists in dom. make in $(document).ready() or $(function()

$(document).ready(function() {     $('#slider > img').hover(function () {         stoploop();     }, function () {         startslider();     }); }); 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -