How to capture a click on a link on a temporary layer that is hidden when the focus changes
        Posted  
        
            by hstoerr
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by hstoerr
        
        
        
        Published on 2010-05-21T11:13:00Z
        Indexed on 
            2010/05/21
            11:20 UTC
        
        
        Read the original article
        Hit count: 308
        
JavaScript
|javascript-events
We have a layer that appears when a certain text input has the focus and that should dissappear when the input loses the focus. I tried to do it like this:
<input type="text" onblur="document.getElementById('hideme').style.display='none'" />
<div id="hideme">Textextext <a href="http://disney.com/">disney</a> text</div>
My problem is: when the user clicks on the link link, the browser does not follow this link. It seems the layer disappears before the browser checks where the click goes. What can I do here?
One idea would be to watch whether the mouse enters the hideme div and not to close it when the mouse cursor is in there, but this seems way to complicated. Do you have a better idea?
By the way: you can try it out very easy by pasting this into the Tryit Editor of w3schools. :-)
© Stack Overflow or respective owner