所以.live 重複綁定,會執行很多次。
juery從1.7版本開始將bind(),live()和delegate()方法合併成了on()方法了同樣unbind(),die( )和undelegate()方法也合併成了off()方法
舊版寫法:
$(".choseme").live("click", function(e){
alert("hello");
});
新版寫法:
$(".choseme").on("click", function(e){
alert("hello");
});
沒有留言:
張貼留言