Search code examples
javascriptjqueryonmouseoveronmouseoutonmouseup

Javascript Mouseover and mouseout actions


I have a code like;

<asp:HyperLink ID="hl" onmouseover="ShowDiv();" onmouseout="HideDiv();" runat="server"/>
<div ID="divid" onmouseover="ShowDiv();" onmouseout="HideDiv();">Test</div>

I want the the hyperlink to show the divid when mouse is over it and at the same time if the user moves the pointer over div the div will not close and will continue to show, but if the user moves the cursor out of div and hyperlink the div will close. What can i implement inside ShowDiv() and HideDiv() functions.

Thank You..

Edit:The divid visibility is set to false at the beginning and it shows when mouse moves over the hyperlink


Solution

  • I could give you the exact answer, but I'd like you to read this article on jQuery's mouseenter and also mouseleave and you will definitely find your answer there (and also learn!) :)