19th Oct 2022, 6:30 AM
Crypto Genesis
Crypto Genesis - avatar
4 Antworten
+ 1
Uncaught TypeError: Cannot set properties of null (setting 'textContent') Line: 10 Error means : you can't set any property (textContent) of null data type. The value of variable element is null because javascript code is executing first, followed by html part get executed. Solution: Place javascript code along html using script tags. Correct code: https://code.sololearn.com/WQqMddMY8GOD/?ref=app
20th Oct 2022, 12:54 AM
Aditya Dhiman
Aditya Dhiman - avatar
+ 1
.A.D. Is it possible to keep this js code outside the html file ?
21st Oct 2022, 9:28 AM
Crypto Genesis
Crypto Genesis - avatar
0
I want to keep js file seperately then how can we do in this example ?
21st Oct 2022, 9:31 AM
Crypto Genesis
Crypto Genesis - avatar
0
Yes, This can be done by wrapping the js code in a function. And call that function from html part (using script tags). https://code.sololearn.com/WQqMddMY8GOD/?ref=app
21st Oct 2022, 1:06 PM
Aditya Dhiman
Aditya Dhiman - avatar