0

Why is there 'style' property not working in js?

https://code.sololearn.com/WQCvNRX7rJ3c/?ref=app

24th May 2021, 4:24 AM
Mohd Huzaifa
Mohd Huzaifa - avatar
3 Answers
+ 2
This is because the javascript is loaded before the html. One way to avoid this is to use the onload event: onload = () => { Your javascript }
24th May 2021, 5:11 AM
Solo
Solo - avatar
+ 2
Share a link to the non working code in the Description, and please add CSS in the tags ☝ https://www.sololearn.com/post/75089/?ref=app
24th May 2021, 4:29 AM
Ipang
+ 2
Huzaifa, Please read the following post, it explains why this problem occurs, and provides also the workaround. https://www.sololearn.com/post/90825/?ref=app
24th May 2021, 5:09 AM
Ipang