+ 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
3 ответов
+ 1
Thank you!
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();
}