Y the Results is null ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
23rd Apr 2019, 7:18 PM
Omar Khalil Bakhsh
Omar Khalil Bakhsh - avatar
2 Answers
+ 1
onload=()=>{ var myarray = new Array (1); myarray[0] = document.getElementById('gg').innerHTML; console.log(myarray[0]); }
23rd Apr 2019, 8:33 PM
Solo
Solo - avatar
0
because the element havent loaded when the script is running. try to wrap them as listerner to body onload, so the script will run after every element inside <body> are loaded
23rd Apr 2019, 7:43 PM
Taste
Taste - avatar