+ 2
Cannot set property InnerHTML of null !!!
Keep getting this error and looked it up online. Most people say to use window.onload but when I look at the examples in the Sololearn tutorials and other people's code they do the same thing without using it. Would love to have someone explain this to me. The program is suppose to input user name and assign a random jersey number. It works using the document.write method commented out but I also want to make the name fit the jersey regardless of the size of their name which is why I need it in the div tags. https://code.sololearn.com/Wu6rIHv66A4m/?ref=app
2 Respostas
+ 1
Wrap your JS code in
window.onload = function () {
... code here...
};
Also, you need to change one to get the I'd of number. They are both set to lastname.
+ 2
Thanks so much ChaoticDawg. It works now. Is this a pretty standard thing you have to do or and I writing this code poorly?