javascript - send event when calling anonymous addEventListener function, then remove it -
so can add event listener , sent event this
(function(){ document.getelementbyid("submitbtn").addeventlistener("click", function(event){ pd(event); }, false); }()); function pd(event){ event.preventdefault(); }
since can't pass event
parameter function want called on click, there way can event
can use named function can remove listener? this seems related, doesn't seem concerned passing parameter event. or there way remove listeners element?
since using jquery, why not use .on , .off? example: jsfiddle
<a class="test">test click</a> <script> $(".test").on("click", function(event){ console.log(event); $(".test").off().text('click handler off'); }); </script>
Comments
Post a Comment