@@ -3,25 +3,32 @@ querySelector - for single
3
3
querySelectorAll - for multiple
4
4
*/
5
5
6
- const result = document . querySelector ( '#result ' ) ;
7
- // change background ul use querySelector (single)
8
- result . style . backgroundColor = '#333' ;
9
- result . style . color = '#fff ' ;
6
+ const listItem = document . querySelector ( '#listItem ' ) ;
7
+ // change background ul
8
+ listItem . style . background = '#333' ;
9
+ listItem . style . color = '#ddd ' ;
10
10
11
- let base_on = document . querySelector ( '.debian-based-on' ) ;
12
- console . log ( base_on ) ; //ubuntu cz use single querySelector
11
+ // if only querySelector, show just first
12
+ let shp = document . querySelector ( '.shp' ) ;
13
+ console . log ( shp ) ; //lutfy
14
+ // if use querySelectorAll
15
+ shp = document . querySelectorAll ( '.shp' ) ;
16
+ console . log ( shp ) ; //show node-list all
13
17
14
- base_on = document . querySelectorAll ( '.debian-based-on' ) ;
15
- console . log ( base_on ) ; //3 show use classes debian cz use multiple querySelectorAll
16
-
17
- // use forEach()
18
- base_on . forEach ( function ( items ) {
19
- console . log ( items ) ;
18
+ // SHP
19
+ const shpObject = [ ...shp ] ;
20
+ shpObject . forEach ( function ( items ) {
20
21
items . style . textTransform = 'uppercase' ;
21
- items . style . color = 'red' ;
22
- items . style . padding = '0.375rem' ;
22
+ items . style . fontSize = '1.25rem' ;
23
+ } ) ;
24
+
25
+ // RHP
26
+ const rhp = document . querySelectorAll ( '.rhp' ) ;
27
+ const rhpObject = [ ...rhp ] ;
28
+ rhpObject . forEach ( function ( items ) {
29
+ items . style . textTransform = 'Capitalize' ;
30
+ items . style . fontSize = '1.25rem' ;
23
31
} ) ;
24
32
25
- // for last li classes
26
- const last = document . querySelector ( 'li:last-child' ) ;
27
- last . style . color = 'green' ;
33
+ const memberRHP = document . querySelector ( 'li:last-child' ) ;
34
+ console . log ( memberRHP ) ;
0 commit comments