0
Plz help someone quick.
I was writing code in web. I wrote it on sololearn website desktop mode and the code was working fine. But the same code is not working on mobile.can some one explain why? Code was getting value of input tag of html using javascript. Eg:- <input type="text" id="field" value="this is text field"> Js- Let data = document.getElementById("field").value; console.log(data); Plz someone explain this asap
5 Antworten
+ 3
If you mean this code:
https://code.sololearn.com/WmUtUFCmeECW/?ref=app
Put the JS scripts in a script tag before </body> in HTML tab
https://www.sololearn.com/post/90825/?ref=app
+ 3
This platform automatically include the scripts in the <head>
Because your getElement function executes before the DOM is created, they returned null.
+ 1
Did you uppercase the “let” keyword? JS is case-sensitive.
+ 1
Gordon hey thanks for helping me out.
I thought this platform is automatically including script tag and stylesheet that's why i didn't included script tag in html code.
Actually website playground was working fine without even including script tag in html.
0
Jeremias thanks for answering but was not the issue