Edit The Code:
See Result »
Try it Yourself - ©
w3ii.com
<
!DOCTYPE
html
>
<
html
>
<
body
>
<
h2
>
A h2 element
<
/h2
>
<
h3
>
A h3 element
<
/h3
>
<
script
>
document.querySelector(
"h2, h3"
).style.backgroundColor =
"red"
;
<
/script
>
<
/body
>
<
/html
>
<!DOCTYPE html> <html> <body> <h2>A h2 element</h2> <h3>A h3 element</h3> <script> document.querySelector("h2, h3").style.backgroundColor = "red"; </script> </body> </html>