+ 4
Rock,paper,scissors buttons are not working as they are supposed to be. Would you mind helping me with this?(solved)
8 Antworten
+ 7
Here, Add your js code in between :
window.onload = () => {
// here
};
+ 7
Reason why you need to wrap your code inside window.onload is because js we type in js tab is same as we js inside head tag.
That js code is rendered before html elements are created and we can't access them, so solution is using window.onload to run js code after html elements are loaded, or moving your js at end of body tag
For code typed in js tab, if you plan to work with DOM (selecting html elements) always wrap it inside window.onload
+ 3
Jayakrishna🇮🇳 Thank you so much♡
+ 2
You're welcome..
+ 1
Randy post your code so we can see
+ 1
Java script line 21 to 29 u are again and again re initialising computer choice so final reinitialization scissors will remain same and won't change .... change if condition to get different outputs for different input from Math.random