+ 1

Why does removeChild not work?

I've been making sort of a browser, and I want it to be where you type in a word, the video linked to that word pops up, and I decided to do that by using the removeChild method on the videos I didn't want, but it seems the system doesn't recognize it. Why is this? My code is below, thank you in advance! https://code.sololearn.com/W54CspHWscfF/?ref=app

23rd Nov 2017, 4:56 PM
jacksonofgames 28
jacksonofgames 28 - avatar
8 Answers
+ 3
Change browser(); to window.onload = browser;
23rd Nov 2017, 5:28 PM
CalviŐ˛
CalviŐ˛ - avatar
23rd Nov 2017, 7:53 PM
jacksonofgames 28
jacksonofgames 28 - avatar
+ 1
You problem is not solved. Not window.onload = browser(); It's window.onload = browser;
24th Nov 2017, 12:04 AM
CalviŐ˛
CalviŐ˛ - avatar
24th Nov 2017, 12:49 AM
jacksonofgames 28
jacksonofgames 28 - avatar
+ 1
Do you want me to call the whole function in window.onload or just declare it in window.onload?
24th Nov 2017, 1:23 AM
jacksonofgames 28
jacksonofgames 28 - avatar
+ 1
I'm very sorry to keep wasting your time, but how do I make it a callback function?
24th Nov 2017, 2:39 AM
jacksonofgames 28
jacksonofgames 28 - avatar
0
No, like this window.onload = browser; Look careful what's the difference? mine code and yours?
24th Nov 2017, 1:17 AM
CalviŐ˛
CalviŐ˛ - avatar
0
If you call browser() on window.onload, you will get error due to elements are not ready. You need to set browser as callback, let onload to call the callback. So set window.onload = browser; to make browser as callback function.
24th Nov 2017, 1:31 AM
CalviŐ˛
CalviŐ˛ - avatar