function attachEvent(element, event, callbackFunction) {
if(element.addEventListener) {
element.addEventListener(event, function(){
removeArray();
callbackFunction(this.getAttribute("src"));
}, false);
}
}
function removeEvent(){
var element = document.querySelectorAll('.Dicon');
element.removeEventListener("click", handler);
console.log("remove");
}
を削除仕事、私はエラーを持っています。カントの使用私は彼らに上をクリックする能力を与えるクラスのコール<strong>ダイコン</strong>、と私はaddEventlistnerを使用するいくつかのイメージを持っていますが、今私はeventlistnerを取り除くためにしたい、何とか私はそれを作るカントイベントリスナに
エラー
Uncaught TypeError: element.removeEventListener is not a function
は、どのように私はこの問題を解決するのですか?彼らはすべてイメージです。あなたは、各項目からリスナーを削除する項目をループする必要があるので、
機能は動作しますが、なんとなくオンクリックは取り外していません。 – darkness
@ T.J.Crowderの説明を参照してください! – baao