Question:
I want to have the to hide an div (id="TestIdName") when another div (class="IdName" is onmouseover.
To detect the right id name, i’m using: ( "TestBoxWindow" + event.target.classname )
Because of that, when I don’t add the class to the elements in the div (class="IdName", it doesn’t work because they don’t have that class.
Is there a way to do it simpler or do I have to add class="IdName" to every element inside the class="IdName"?
The code:
HTML
<div class="SomethingElse">
<div onmouseover="MyFunction(this)" class="IdName">
<div class="IdName"></div>
<p class="IdName">Search</p>
</div>
</div>
<div id="TestIdName"
in Javascript
function MyFunction(x)
{
document.getElementById("Test" + event.target.classname).style.display
= 'none';
}
Try this