Answer the question
In order to leave comments, you need to log in
How to do something similar to the hover property in javascript for a group of elements?
I started to study js, for understanding I want to do hover(css) on js, I could do it for one element through onmouse... reacted to onmouse... ?
<!DOCTYPE html>
<html lang="ru">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="style.css">
<title>Document</title>
</head>
<body>
<table id="box">
<tr>
<td>first</td>
</tr>
<tr>
<td>second</td>
</tr>
<tr>
<td>third</td>
</tr>
<tr>
<td>fourth</td>
</tr>
<tr>
<td>fifth</td>
</tr>
</table>
<script src="script.js"></script>
</body>
</html>
var a;
a = document.getElementById("box").children;
a.onmouseover = function() {
this.style.backgroundColor = "green";
}
Answer the question
In order to leave comments, you need to log in
Do you want all elements in a row to respond to the hover of one element?
Hang an event on the row itself and do what you want with the child elements.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question