Whenever I hover over the entire DIV kontakt-block, I want the text in the span TEXT-DISPLAY to be altered. It's easy for me to do this when there is only one kontakt-block. However, I face a challenge when it comes to dealing with classes. In each span, I require a different text to be displayed upon hover.
<div class="kontakt-block color1" onmouseover="changeText('<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="1c79717d75705c7b717d7570327f73">[email protected]</a>')" onmouseout="defaultText('Email')">
<div class="kontakt-block-zawartosc">
<span class="text-display">Email</span>
</div>
</div>
<div class="kontakt-block color2">
<div class="kontakt-block-zawartosc">
<span class="text-display">Phone</span>
</div>
</div>
<div class="kontakt-block color3">
<div class="kontakt-block-zawartosc">
<span class="text-display">Facebook</span>
</div>
</div>
<script>
function changeText(text) {
var display = document.getElementsById('text-display');
display.innerHTML = "";
display.innerHTML = text;
}
function defaultText(textd) {
var display = document.getElementsById('text-display');
display.innerHTML = "";
display.innerHTML = textd;
}
</script>
This implementation works well for altering text within a single span, however, challenges arise when multiple spans are involved.