Is it possible to apply the same style to multiple elements at the same time? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is it possible to apply the same style to multiple elements at the same time?

document.(body, container, text).style.backgroundColor = colors[rdmClrInt]; Note: container and text are predefined variables with the value of their respective elements

16th May 2020, 6:21 PM
Sajid
Sajid - avatar
4 Answers
+ 2
Sajid Yes using class attribute
16th May 2020, 6:29 PM
A͢J
A͢J - avatar
+ 4
Sajid You can give same class to multiple elements and by using jQuery you can apply CSS.
16th May 2020, 6:38 PM
A͢J
A͢J - avatar
+ 2
AJ #Infinity Love ohh right. That totally slipped out of my mind. Thanks
16th May 2020, 6:39 PM
Sajid
Sajid - avatar
+ 1
AJ #Infinity Love couldn't get you.
16th May 2020, 6:31 PM
Sajid
Sajid - avatar