I am currently working the front-end on a website. I am using jquery in order to create a dynamic content.
My problem is that when I type my URI (localhost/jquery/my
I found some solution for this problem.
$(document).on("mousemove",".objectclass",function(){
console.log("mousemove");
});
its works fine!
Try using on() if you are using a recent version of jQuery (1.7+), or delegate() if its an older version, instead of just hover()
Like this:
$("#main-content").on("mouseenter", "#items .item", function(event){
// your function
}).on("mouseleave", "#items .item", function(event){
// your function
});
See: http://api.jquery.com/on/
When working with dynamic content be sure to use jquery.on
(the newer version of live).
$.on('click', function(){
});
instead of
$.click(function(){});