I want to give content paragraph with my function and display it in browser. I have error. Thanks you. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I want to give content paragraph with my function and display it in browser. I have error. Thanks you.

Give and Display content. https://code.sololearn.com/WmE5Tino4v9o/?ref=app

20th Jan 2021, 5:13 AM
Malick Diagne
Malick Diagne - avatar
2 Answers
+ 1
You made a mistake, you shouldn't have called that contenteChild function out.. It's better you do it these way.. 👇👇👇 addEventListener('load', () =>{ //you then call that function here contenteChild() }) //Then you write the function below function contenteChild(){ document.getElementById('child').innerHTML = "malick" }
20th Jan 2021, 5:28 AM
Larsun
Larsun - avatar
0
Use onload() in JS to run the code after the page is loaded. window.onload = () => { function contenteChild () { document.getElementById ("child").innerHTML = "malick"; } contenteChild(); }
20th Jan 2021, 5:15 AM
Bibek Oli
Bibek Oli - avatar