I'm trying to add some content inside my divs on hover, but not the CSS way.
function hover(description){
console.log(description);
document.getElementById('first-item').innerHTML = description;
document.getElementById('second-item').innerHTML = description;
}
.slide {
background: blue;
width: 200px;
height: 200px;
float: left;
margin: 10px;
}
<?php
$content = "some text";
?>
<div>
<div>
<div class="slide" id="first-item" onmouseover="hover('<?php echo $content; ?>')" onmouseout="hover('')"></div>
<div class="slide" id="second-item" onmouseover="hover('<?php echo $content; ?>')" onmouseout="hover('')"></div>
<div class="slide" id="third-item"></div>
</div>
</div>
I want only the content of the .first-item
to change when I hover it and only the content of the .second-item
to change when I hover it. But as you can see when I hover either one, the content of both changes.
What did I do wrong?
</div>