View Single Post
08-24-2008, 10:25 AM
#1
dicetomato is offline dicetomato
Status: Member
Join date: Jan 2006
Location: Orange County, CA
Expertise:
Software:
 
Posts: 117
iTrader: 0 / 0%
 

dicetomato is on a distinguished road

  Old  Need jQuery help

Hello, having some problem with javascription.

What I'm trying to accomplish is:

1. on default, div#options-dropdown is hidden.
2. When user clicks on div#options, #options-dropdown shows up.
3. After that, when a user clicks on any part of the browser other than #options-dropdown, the #options-dropdown hides.

Here is the code:

Code:
$(document).ready(function() { 
	$(document).click(function(event) {
		$("#options-dropdown").hide();
		if ((event.target == $('#options-dropdown')) && (event.target == $('#options'))) {
			$("#options-dropdown").show();
		} 
	});	
});
Thanks in advance!