javascript - Show/hide div on mouse over -
javascript:
$( document ).ready(function() { function show(id) { document.getelementbyid(id).style.visibility = "visible"; } function hide(id) { document.getelementbyid(id).style.visibility = "hidden"; } });
and html:
<table> <tr> <td id="one"> <div class="content" onmouseover="show('text')" onmouseout="hide('text')"> <h1>heading</h1> <p id="text">lorem ipsum</p> </div> </div> </td> </table>
lorem ipsum supposed show when mouse hovers on content div, doesn't work. encased in table because there 3 other content divs make 2 2 grid.
show
not on global object, it's in closure, when html event handlers tries call it, doesn't exist.
use css instead
#text { visibility: hidden; } .content:hover #text { visibility: visible; }
Comments
Post a Comment