+ 1

add Attributes JavaScript

How can i add to all elements with the className "digit" the attribute r="2.5px"? -> https://code.sololearn.com/W27JVf29KuFV/#html <-

21st Aug 2018, 9:53 PM
Michelle Becker
Michelle Becker - avatar
3 Answers
+ 1
sorry i made a mistake that's why i remove first answer check this: https://code.sololearn.com/WjlRGHz2GYce/#html
21st Aug 2018, 11:20 PM
MO ELomari
MO ELomari - avatar
+ 1
That worked: window.onload = function (){ var digits= document.getElementsByClassName("digit"); for (i = 0; i<digits.length; i++) digits[i].style.r = "2.5px"; }
21st Aug 2018, 11:20 PM
Kapi
+ 1
Thank you both 😀 you helped really much
22nd Aug 2018, 12:08 AM
Michelle Becker
Michelle Becker - avatar