I recreated a Select box and its dropdown function using this:
$(".selectBox").click(function(e) {
if (!$("#dropDown").css("display") || $("#dropDown").css("display") == "none")
$("#dropDown").slideDown();
else
$("#dropDown").slideUp();
e.preventDefault();
});
The only problem is that if you click away from the box, the dropdown stays. I'd like it to mimic a regular dropdown and close when you click away, so I thought I could do a 'body' click:
$('body').click(function(){
if ($("#dropdown").css("display") || $("#dropdown").css("display") != "none")
$("#dropdown").slideUp();
});
But now, when you click the Select box, the dropdown slides down and right back up. Any ideas what I'm doing wrong? Thanks very much in advance...