rafchikcv,
<!DOCTYPE html>
<html>
<head>
<title>Untitled</title>
<meta charset="utf-8">
<style type="text/css">
.red {
background-color: #FF0000;
color: #FFFFFF;
}
</style>
</head>
<body>
<div class='module'>
<div class='ololo'>
<h3 color='white'>
<i class='module-actions-icon'></i>Fortnite</h3>
<div>
<img id= "fortphoto" alt = "КупитьFortnite"onclick = "window.location=''" src=""></div></div></div>
<div class='module'>
<div class='ololo'>
<h3 color='white'> <i class='module-actions-icon'></i>CS:GO</h3>
<div>
<img id= "csgophoto" alt = "Купить CS:GO"onclick = "window.location=''" src=""></div></div></div>
<script>
let divs = ["#fortphoto","#csgophoto"].map(id => [...document.querySelectorAll(".module")].filter(div => div.querySelector(id))[0]);
divs.forEach(div => div.classList.add("red"))
console.log(divs)
</script>
</body>
</html>