delegate is not a function
我有一個<table>位於整個document的第三個位置,而這個 <table>的下面好幾層(5~6層吧)有<img>
我想要為這個img加上事件,想到最近學的delegate, 就想拿來用,但是卻一直出現"delegate is not a function"這個錯誤訊息。
code如下所示
$('table')[2].delegate("img", "click", function () {
var a=$(this).parent().parent().parent().parent();
a.css("background-color","DarkGray");
});
為什麼會這樣哩? |