javascript - jQuery not working when inside a document ready function -
i've had problem days , after looking around , google cannot seem fix it.
i working offline in wamp building website. including jquery in <head>
section using google api's:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
it seems other jquery plugins work apart ones im trying build myself.
all written jquery placed in file called sitename.js
, in /js/
directory other js scripts.
now thing is, can't seem $(document).ready(function()
work, or click events.
this script:
$(document).ready(function(){ console.log("test"); });
when move console.log
outside document ready function, displays in console (firebug) when inside, not.
click events not work either, , have no idea why:
$('.more').live("click",function(){ console.log("test"); }
this not work either, , have div class name of more
.
i'm not sure problem is, whether incorrect code or script interfering one. in advance suggestions or answers
live
not supported more jquery v. 1.9.1
use .on()
instead:
$("#parent").on("click", ".more", function(){ console.log("test"); });
Comments
Post a Comment