Hide list on blur
Posted
by bah
on Stack Overflow
See other posts from Stack Overflow
or by bah
Published on 2010-03-29T19:38:46Z
Indexed on
2010/03/29
19:53 UTC
Read the original article
Hit count: 415
Hi, I have a list showing up when i click on button, the problem is that i want to hide the list whenever it loses focus i.e. user clicks anywhere on a page, but not on that list. How can i do this? Also, you can see how it should look at last.fm, where's list of profile settings (li.profileItem). (ul.del li ul by default is display:none) Basic list structure:
<ul class='del'>
<li>
<button class='deletePage'></button>
<ul>
<li></li>
<li></li>
</ul>
</li>
</ul>
My function for displaying this list:
$(".deletePage").click(function(){
if( $(this).siblings(0).css("display") == "block" ){
$(this).siblings(0).hide();
} else {
$(this).siblings(0).show();
}
});
© Stack Overflow or respective owner