Cannot read property 'addEventListener' of null
See original GitHub issueHey there!
I’m having a issue with ember 2.7.0 and ember-power-select 1.0.0-beta.8.
trigger.js:43 Uncaught TypeError: Cannot read property 'addEventListener' of null
The stack trace points to https://github.com/cibernox/ember-power-select/blob/a6364c7fe1692817c4572e7623116757e470b170/addon/components/power-select-multiple/trigger.js#L46
With ember 2.6.1 this error does not happen.
Issue Analytics
- State:
- Created 7 years ago
- Reactions:5
- Comments:18 (7 by maintainers)
Top Results From Across the Web
Cannot read property 'addEventListener' of null - Stack Overflow
I think the easiest approach would be to just check that el is not null before adding an event listener: var el =...
Read more >Uncaught TypeError cannot read property 'addeventlistener' of ...
In JavaScript, a very common error is the Uncaught TypeError Cannot read property 'addeventlistener' of null. This error occurs when JavaScript is not...
Read more >[SOLVED] Cannot Read Property 'addEventListener' of Null in ...
To fix the “cannot read property 'addEventListener' of null” error, make sure the selector used the access the element is properly defined.
Read more >Cannot read property 'addEventListener' of Null in JS
The error "Cannot read property addEventListener of null" occurs when we call the addEventListener() method on a DOM element that doesn't exist.
Read more >Cannot read property 'addEventListener' of null - JavaScript
I'm working on this simple ToDo list script but get the following error: “Uncaught TypeError: Cannot read property 'addEventListener' of ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Let me post some of my findings:
I had ember-power-select
v1.0.0-beta.17
installed and ember-power-select-with-createv0.1.10
, when I updated to ember-power-select-with-create v0.2.0 it started working.Long version: I updated my package.json to reference the latest commit in Ember Power Select like this
"ember-power-select": "git://github.com/cibernox/ember-power-select.git#b43879f13f0d2b3e19999ec5275f53c3b05ffcf0",
That didn’t work (I did delete
node_modules
andbower_components
and reinstalled), one thing that I found odd was that while navigating through the source in my project I had the following code intrigger.js
for power-select-multiple.var optionsList = document.getElementById(this.elementId + '-ember-power-select-multiple-options');
But looking for this line of code in EPS source code, I could only find a reference to this.elementId in the changelog saying that it was removed. Which means that I was somehow using an “older” power-select?
That’s when I remembered to update power-select-with-create which now has on its own package.json version 1.0.0-beta.14, but previously (on 0.1.10 has version 0.10.X of EPS).
Hope it helps someone.
I’ll try to get a twiddle up in the next few days