+ 18
How is it possible to change the style by a user input?
/*var cng = prompt("width size") document. getElementById("test").style.width"" */ I am trying to put style.width"cng" but width is not being changed. It is being changed just by a number entry
5 ответов
+ 3
getElementById("test").style.width = cng + "px"
Does this not work?
If not i might be on the wrong track and look into it again.
It would be nice if you could provide a code sample here on sololearn :)
+ 15
I have tried it but the same size.
+ 15
Thanks Dragonxiv it is working now
cng was in ""🙄
+ 1
You have to add "px" after it.
Or any other size indication like "em" or others
+ 1
+6