Everything is working now. Thanks to all. Last version of code is: $(document).ready(function(){ $("#link").click(function(){ if ($("#divLoginBox1").is(':hidden')) $("#divLoginBox1").show(); else{ $("#divLoginBox1").hide(); } return false; });
$('#divLoginBox1').click(function(e) { e.stopPropagation(); }); $(document).click(function() { $('#divLoginBox1').hide(); }); }); On May 2, 7:29 pm, "Josh Nathanson" <[EMAIL PROTECTED]> wrote: > Looks like you are missing a semicolon which will choke IE: > > $("#link").click(function(){ > if ($("#divLoginBox1").is(':hidden')) > $("#divLoginBox1").show(); > else{ > $("#divLoginBox1").hide(); > } > return false; > }) <-- ADD SEMICOLON HERE > > -- Josh > > ----- Original Message ----- > From: "Aleksandr" <[EMAIL PROTECTED]> > To: "jQuery (English)" <jquery-en@googlegroups.com> > Sent: Friday, May 02, 2008 11:00 AM > Subject: [jQuery] Re: Hide/Close div when clicked outside of it. > > > I am now have this jQuery code and it is working in FireFox, Safari > > and Opera but not in IE 6, 7: > > > $(document).ready(function(){ > > $("#link").click(function(){ > > if ($("#divLoginBox1").is(':hidden')) > > $("#divLoginBox1").show(); > > else{ > > $("#divLoginBox1").hide(); > > } > > return false; > > }) > > > $('#divLoginBox1').click(function(e) { > > e.stopPropagation(); > > }); > > $(document).click(function() { > > $('#divLoginBox1').hide(); > > }); > > }); > > > On May 2, 6:00 pm, sawmac <[EMAIL PROTECTED]> wrote: > >> try this > > >> $('#divLoginBox1').click(function(e) { > >> e.stopPropagation();}); > > >> $(document).click(function() { > >> $('#divLoginBox1').hide(); > > >> }); > > >> --dave