<!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>