![]() |
Show a hidden div by clicking anywhere on the page
I got this script of the internet that toggles a hidden div on/off. I have converted this script into a drop down menu so the hidden div is the second level of the menu and is floating above the rest of the content. Can anyone please show me how to go about modifying the script so that the hidden div is hidden again when i click anywhere on the page other than the div itself instead of having to toggle it. Thanks. ps. hope this wasn't too confusing.
HTML Code:
<div id="mydiv"><a href="javascript:unhide('mydiv2');">Click here to show content</a>Code:
.hidden { display: none; }Code:
<script type="text/javascript"> |
Add the onblur event of the div itself:
<div id="mydiv" onblur='unhide("mydiv")'><a href="javascript:unhide('mydiv2');">Click here to show content</a> </div> |
Quote:
This didn't seem to work... Any other suggestions. Thanks. |
Sorry for that put the blur event on the anchor like this:
<div id="mydiv"><a onblur='unhide("mydiv")' href="javascript:unhide('mydiv2');">Click here to show content</a> </div> |
Thanks. Solved it now.
|
If what I said helped solved your problem please thank me using the thank button.
I apologize if I appear rude but I am trying to increase my credit in this forum. Thank you. |
| All times are GMT +1. The time now is 10:24 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.