[HELP] Selectioning in Js don't work | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

[HELP] Selectioning in Js don't work

Hello everyone , i'm really sorry because this is a really newby question and this is supposes to be so simple but i just can't figure this out :( . Why do the code send back "null" to this ?? This is really disturbing and blocking me on another more complex code .. Thank you very much https://code.sololearn.com/WKiI93U9vrv7/?ref=app

10th Aug 2017, 4:10 PM
Lucas Lareginie
Lucas Lareginie - avatar
5 Answers
+ 10
Yes, you can also use any alternative onload event, i recommend to read something about. Also, you can omit an onload event and put all your code after the <body> in a <script> tag, not the best practice. Also, you can omit an onload event initializing global variables after the <body> in a <script> tag and put your main content elsewhere, maybe adding event inside tags, such as: <body onclick="func()"></body> The best practice is separate the HTML content from the JS content and use an onload event. In your environment you can put the <script src="file.js"> after the <body> element, in Sololearn (until you use an external source) you can't, CodePlayground uses tabs!
10th Aug 2017, 4:25 PM
Maz
Maz - avatar
10th Aug 2017, 4:15 PM
Maz
Maz - avatar
+ 8
My pleasure!
10th Aug 2017, 4:28 PM
Maz
Maz - avatar
+ 1
Thank you very much
10th Aug 2017, 4:26 PM
Lucas Lareginie
Lucas Lareginie - avatar
0
Alright thank you very much ! But is this necessary because i'm coding via SL app ? Because i have never done such a thing when i code on my computer's environment
10th Aug 2017, 4:19 PM
Lucas Lareginie
Lucas Lareginie - avatar