This is because that two anonymous functions are completely different functions. Your removeEventListener
‘s argument is not a reference to the function object that was previously attached.
function foo(event) { app.addSpot(event.clientX,event.clientY); app.addFlag = 1; } area.addEventListener('click',foo,true); area.removeEventListener('click',foo,true);
Related Posts:
- addEventListener vs onclick
- Cannot read property ‘addEventListener’ of null
- how to fix : ” TypeError: Cannot read property ‘addEventListener’ of null”…?//
- What’s the difference between event.stopPropagation and event.preventDefault?
- What does on() in JavaScript do?
- How to remove all listeners in an element?
- moving an element in JS
- Angular 2 Hover event
- Fire oninput event with jQuery
- Why onbeforeunload event is not firing
- What is the Javascript event for an item being added to the cart in Woocommerce?
- List of JS Events for Widgets?
- iFrame onLoad in custom Gutenberg block
- What is console.log?
- Can I use complex HTML with Twitter Bootstrap’s Tooltip?
- How do I redirect to another webpage?
- Invariant Violation: Objects are not valid as a React child
- Compare two dates with JavaScript
- How can I merge properties of two JavaScript objects dynamically?
- In reactJS, how to copy text to clipboard?
- SyntaxError: Adjacent JSX elements must be wrapped in an enclosing tag
- Uncaught SyntaxError: Invalid or unexpected token
- JavaScript TypeError: Cannot read property ‘style’ of null
- Invalid shorthand property initializer
- nodejs – error self signed certificate in certificate chain
- How do I loop through or enumerate a JavaScript object?
- Getting Unexpected Token Export
- XMLHttpRequest cannot load XXX No ‘Access-Control-Allow-Origin’ header
- Uncaught TypeError: Cannot read property ‘props’ of null
- How to use iMonkey in an iOS app
- What’s the difference between “Array()” and “[]” while declaring a JavaScript array?
- Mouseover & Mouseout w/ Javascript
- Format JavaScript date as yyyy-mm-dd
- Angular JS Uncaught Error: [$injector:modulerr]
- Nested objects in javascript, best practices
- Scroll Automatically to the Bottom of the Page
- npm WARN … requires a peer of … but none is installed. You must install peer dependencies yourself
- How do I check if string contains substring?
- How to measure time taken by a function to execute
- var.replace is not a function
- Uncaught TypeError: Cannot read property ‘call’ of undefined at __webpack_require__
- Async/await in componentDidMount to load in correct order
- Dynamically load JS inside JS
- Tainted canvases may not be exported
- How to open a URL in a new Tab using JavaScript or jQuery?
- How to sort an object array by date property?
- React router not showing browser history
- How to define DO NOTHING in JavaScript
- How to get the difference between two arrays in JavaScript?
- Failed to execute ‘postMessage’ on ‘DOMWindow’: https://www.youtube.com !== http://localhost:9000
- How can I check whether a radio button is selected with JavaScript?
- JavaScript button onclick not working
- What counts as CPU Intensive tasks (eg. sorting, searching etc?)
- HTML make text clickable without making it a hyperlink
- Uncaught ReferenceError: React is not defined
- How to get the browser viewport dimensions?
- Getting HTML form values
- What is the equivalent of Java’s System.out.println() in Javascript?
- How can I exit from a javascript function? [duplicate]
- Object doesn’t support property or method ‘addEventListener’
- How to fix javascript .toFixed is not a Function error
- jQuery checkbox checked state changed event
- Javascript, viewing [object HTMLInputElement]
- etect the Enter key in a text input field
- Implementing Isomorphic JavaScript (React JS) in WordPress?
- Any advantage of using wp_scripts and is_IE when enqueuing scripts
- TinyMCE in a div / textarea on frontend?
- Include Javascript as Plain (No file inclusion)
- Adding wp_ajax to a theme outside functions.php (on specific template page)
- Insert shortcode in post editor from javascript (Visual / HTML)
- WordPress problem with htmlentities
- Provide specific example for block variation
- Block editor: How to check if block editor has initialized and populated the data store?
- Contact Form 7 – Give each checkbox a class?
- How to add a custom.js file for a child-theme in a swift way?
- WP REST API Post Status Using JavaScript
- var is undefined in a Gutenberg block
- Custom wp.editor.initialize settings ignored
- Why my javascript code not working for the dashboard of wordpress admin?
- Detect When User Reads Full Article? [closed]
- Got a TypeError after update and need to adapt found solution
- How to add classes and events to image in javascript using Gutenberg?
- How do you filter the list of states when country is selected? [closed]
- Prevent update_checkout from firing mid-typing
- Adding Code into Theme Customizer Header
- Javascript in wordpress
- Suddenly extra hex string in tags
- How to inherit custom javascript from parent to child pages?
- Including Styles and JS files to work ON my plugin interface
- Gutenberg – useEffect manipulate DOM after block re-renders DOM
- how to add a custom javascript file to our theme
- Why does my array sort order changes when I pass it to JS using WP_REST_Response?
- WordPress Guternberg Content For React Native
- Custom block update rendering when reused
- Spans in gutenberg
- Get a default customizeAction text for a section using Customizer JS API
- contact form 7 javascript and wpcf7_before_send_mail action
- custom page url slug needs illegal ?id=1 for javascript
- Use one javascript variable into another javascript file
- Embed Kajabi into WP