0

How can I use jQuery to bind when the mouse is over an element it perform an action. ? my code

$("div").bind('mouseover',function(){

  my_function();

});
4

2 回答 2

1
    $("#elementID").on('mouseover', function(event) {
        //code goes here
    });

您应该使用 .on() 而不是 .bind();

http://api.jquery.com/on/

于 2013-07-23T17:04:46.050 回答
-1
 $("seletor").bind('mouseover', function(event) {

 });
于 2013-08-13T20:54:34.290 回答