How can i change opacity in js? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

How can i change opacity in js?

I think on sololearn it doesn’t work cuz i waste a lot of time to do this.

14th Aug 2018, 7:26 PM
The Krutoi Malchik
The Krutoi Malchik - avatar
7 Answers
+ 5
window.onload=function
15th Aug 2018, 12:57 PM
Subrahmanya Mayya
Subrahmanya Mayya - avatar
+ 5
Have you ever tried this JS code: window.onload = function() { var a = document.getElementById("a"); a.style.opacity = 1; } where the thing you want to change the opacity has the id "a".
14th Aug 2018, 7:32 PM
Ledio Deda
Ledio Deda - avatar
+ 4
You can use DOM to acces the style of a object with JS. I have no idea why this doesn't work for you, BUT you can use w3schools to get in hands with DOM and maybe solve your problem. Good luck!
15th Aug 2018, 8:46 AM
🈂️Toma
🈂️Toma - avatar
+ 2
https://code.sololearn.com/Wu4bNz5dYBTP/?ref=app You have to add those CSS lines...
15th Aug 2018, 9:28 AM
Ledio Deda
Ledio Deda - avatar
+ 1
Yes, i try this js code. A lot of variation. But it doesn’t work, so check my code nia pls.
15th Aug 2018, 8:30 AM
The Krutoi Malchik
The Krutoi Malchik - avatar
+ 1
The Krutoi Malchik Could you please show us the code??
15th Aug 2018, 9:01 AM
Ledio Deda
Ledio Deda - avatar
15th Aug 2018, 9:18 AM
The Krutoi Malchik
The Krutoi Malchik - avatar