0

javaScript isn't style content

I tried the same code in another stylesheet, it was working properly. But it's not working in SoloLearn code player. I want to do some styles with section tag through javaScript. Kindly solve this BUGGgg. https://code.sololearn.com/Wy7F9cy7fbvU/?ref=app

27th Jun 2020, 11:04 AM
Muhammad Usman
Muhammad Usman - avatar
2 Answers
+ 5
window.onload=function(){ document.querySelector('section').style.width="50%"; } To allow script to run only after document get loaded,you can search for similar answers to know about it it more detail!
27th Jun 2020, 11:13 AM
Abhay
Abhay - avatar
0
Thanks Abhay. Now it's working fine
27th Jun 2020, 1:37 PM
Muhammad Usman
Muhammad Usman - avatar