+ 1

How do you make a function a callback function?

I keep trying to use the removeChild method in a function, but it doesn't work because it needs to be a callback function to access the html. How do I make it a callback function? Thanks in advance https://code.sololearn.com/W54CspHWscfF/?ref=app

15th Dec 2017, 9:07 PM
jacksonofgames 28
jacksonofgames 28 - avatar
3 Réponses
+ 1
Thank you!
16th Dec 2017, 1:20 PM
jacksonofgames 28
jacksonofgames 28 - avatar
0
onload = function(){ alert('Browser accepts 3 inputs: "tie a tie", "build a house", "die"'); function browser() { var box = prompt("", "How to"); console.log(box); var tie = document.getElementById("tie"); var house = document.getElementById("house"); var die = document.getElementById("die"); var videos = document.getElementById("videos"); if (box === "How to tie a tie") { videos.removeChild(house); videos.removeChild(die); } else if (box === "How to build a house") { videos.removeChild(tie); videos.removeChild(die); } else if (box === "How to die") { videos.removeChild(tie); videos.removeChild(house); } else { document.write("Browser does not recognize your request"); } } browser(); }
15th Dec 2017, 9:20 PM
Catty