0
Web code works on IOS but not on Android
My web code (JavaScript, HTML and CSS) works totally fine on my iPhone (so when I use IOS) but there is an error thrown when the code is run on Android (both tested in Sololearn Code Playground). Can anyone tell me what to do? Here is my code, it is a draft: https://code.sololearn.com/W2SB7az7kavQ/?ref=app
4 Answers
+ 5
The problem is that the code is executed before the web has been loaded, so when you try to use an element in JavaScript, it does not yet exist.
To fix it you must have your javascript code like this:
window.onload = function() {
// Your code here
}
+ 1
the eval in your code is not an good idea ... it's basically giving the user the consoleđ
0
what does it say?
0
Thank you that helps.