+ 2

Why does removeChild not work?

Why can't the console identify my references to html elements with removeChild? Is it because it is in a function? I cant figure it out, any help would be appreciated. Thank you. https://code.sololearn.com/Wj08FS8TYDSe/?ref=app

3rd Feb 2018, 9:22 PM
jacksonofgames 28
jacksonofgames 28 - avatar
16 Answers
3rd Feb 2018, 11:27 PM
John Wells
John Wells - avatar
+ 2
I may not be doing it right but I don't think it works https://code.sololearn.com/Wj08FS8TYDSe/?ref=app
3rd Feb 2018, 10:13 PM
jacksonofgames 28
jacksonofgames 28 - avatar
+ 2
It usually always does
3rd Feb 2018, 11:25 PM
jacksonofgames 28
jacksonofgames 28 - avatar
+ 2
I hadn't tried that yet, but it doesn't work because body is not defined before it is declared on line 12
3rd Feb 2018, 11:30 PM
jacksonofgames 28
jacksonofgames 28 - avatar
+ 2
Ive checked a lot of websites, tried a few solutions without any luck, and havent really found any clear answers. Is there any surefire way to solve this?
4th Feb 2018, 12:45 AM
jacksonofgames 28
jacksonofgames 28 - avatar
+ 2
Sorry I missed your questions. I've updated my program and fixed the issues, if you still need it. You were overloading enter and show as both variables and functions.
27th Feb 2018, 7:32 PM
John Wells
John Wells - avatar
+ 1
But that will cause another error. My buttons will not work because they are embedded in another function
3rd Feb 2018, 10:26 PM
jacksonofgames 28
jacksonofgames 28 - avatar
+ 1
But when you do that, then type in a password shorter or longer than required, it says nothing
3rd Feb 2018, 10:37 PM
jacksonofgames 28
jacksonofgames 28 - avatar
+ 1
When you enter a password that is too short or too long, it should say "That password is too short/long, please restart the program and try again"
3rd Feb 2018, 10:41 PM
jacksonofgames 28
jacksonofgames 28 - avatar
+ 1
The JavaScript console does not recognize the type() function because it is in another function
3rd Feb 2018, 10:45 PM
jacksonofgames 28
jacksonofgames 28 - avatar
+ 1
I just cant figure out why it doesn't work
3rd Feb 2018, 11:25 PM
jacksonofgames 28
jacksonofgames 28 - avatar
+ 1
That's okay, I've got it figured out now
27th Feb 2018, 8:20 PM
jacksonofgames 28
jacksonofgames 28 - avatar
- 1
id must be in quotes id="pop". Also that's not how removeChild() function works. It takes node object as argument. https://www.w3schools.com/jsref/met_node_removechild.asp
3rd Feb 2018, 9:55 PM
Toni Isotalo
Toni Isotalo - avatar
- 1
remove window.onload = type(); and wrap you entire code with that onload function.
3rd Feb 2018, 10:25 PM
Toni Isotalo
Toni Isotalo - avatar
- 1
Works for me when you also change child nodes to body.childNodes [1] body.childNodes [2]
3rd Feb 2018, 10:33 PM
Toni Isotalo
Toni Isotalo - avatar
- 1
Oh yeas you need to remove the type() function or call it right in the beginning after onload function
3rd Feb 2018, 10:42 PM
Toni Isotalo
Toni Isotalo - avatar