I have a HTML table and want to show and hide class for multiple div separate only with javascript. This table will be generated from PHP script there will like 1000 tag.
I hope a smart javascript function can do this job:
function showiteam() {
document.querySelector(".zoom").style.display = "block";
}
function hideiteam(x) {
document.querySelector(".zoom").style.display = "none";
}
#customers td,
#customers th {
border: 1px solid #ddd;
padding: 8px;
}
.zoom {
display: none;
}
<table id="customers">
<tr>
<th>Company</th>
<th>Contact</th>
<th>Country</th>
</tr>
<tr>
<td onmouseover="showiteam()" onmouseout="hideiteam()">
Google
<div class="zoom">This Testing text</div>
</td>
<td>Yahoo</td>
<td>Facebook</td>
</tr>
<tr>
<td onmouseover="showiteam()" onmouseout="hideiteam()">
Google
<div class="zoom">This Testing text</div>
</td>
<td>Yahoo</td>
<td>Facebook</td>
</tr>
</table>