具有一个选择器的多个事件处理程序的JQuery .on()方法
试图弄清楚如何将Jquery .on()方法与具有多个关联事件的特定选择器一起使用。我以前使用过.live()方法,但不确定如何使用.on()完成相同的功能。请在下面查看我的代码: $("table.planning_grid td").live({ mouseenter:function(){ $(this).parent("tr").find("a.delete").show(); }, mouseleave:function(){ $(this).parent("tr").find("a.delete").hide(); }, click:function(){ //do something else. } }); 我知道我可以通过以下方式分配多个事件: $("table.planning_grid td").on({ mouseenter:function(){ //see above }, mouseleave:function(){ //see above } click:function(){ //etc } }); 但是我相信.on()的正确用法将是这样的: $("table.planning_grid").on('mouseenter','td',function(){}); 有没有办法做到这一点?还是这里的最佳实践是什么?我尝试了下面的代码,但没有骰子。 $("table.planning_grid").on('td',{ mouseenter: function(){ /* event1 */ }, mouseleave: function(){ /* event2 */ }, click: function(){ /* …