Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught TypeError: Container is null #155

Closed
danielschlingmeier opened this issue Dec 27, 2020 · 3 comments
Closed

Uncaught TypeError: Container is null #155

danielschlingmeier opened this issue Dec 27, 2020 · 3 comments

Comments

@danielschlingmeier
Copy link

Hello!

A first thanks a lot for this nice color picker! I used it on my ESP8226 Smart Lamp project for quite a while now and I like it! :) However I updated today from an old version (please don't ask me which one, some years old :-)) and now Firefox Console throws a failure:
grafik

I am not an expert, but I had a look at the code and it seems it has something to do with finding the HTML container aka parent element of type div, which does obviously fail and return a null. I double checked my HTML and JS and copied in the example code in the end, but it didn't change anything:

grafik

grafik

However the color picker works so far (surprisingly), I can use the events, so it works so far. What doesn't work is accessing it via its HTML ID or class via CSS, which points a bit into the direction as well, I think.

Best regards
Daniel

@jaames
Copy link
Owner

jaames commented Dec 27, 2020

Hi! Thanks for the kind words :)

I'm not really sure what's causing this, it looks like you might be trying to create a new color picker before the HTML container for it has been loaded and parsed? iro.js should be able to handle that though, so this is weird :/

I can't recreate it myself, so if you're able to reproduce the problem in a Codepen or a Github repo that would be really helpful. Cheers!

@danielschlingmeier
Copy link
Author

Hello!

Okay, I found the problem and I have to admit it is basically sitting in front of my screen :D

This happens, when one copy&pastes the Color Picker object creation snipplet from one place to another in the java script, renames the HTML ID of the

container forgets about the old code. The pasted code snipplet works, but the old one complains that it can't find the container under the given name...and justifiably so.

Anyway the error is gone now. Sorry for bothering you with my learning JavaScript problems here :-)

@jaames
Copy link
Owner

jaames commented Dec 27, 2020

No worries! Good to see that you got to the bottom of it anyway :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants