Out of curiosity, is IE compatible with the $(window).bind function?

In testing my solution, IE6/IE7 doesn't seem to recognize the click at
all. For a simple test, I simply did the following:

$(window).bind('click', function(ev) {
      alert("clicked");
      ....
}

In Firefox and Safari, I get the alert box. However, in IE6/IE7
there's no response whatsoever.

Any thoughts on what might be causing this?

Thanks,
-v

On Aug 24, 5:06 pm, gr00vy0ne <[EMAIL PROTECTED]> wrote:
> Thank you sooooo much! That's exactly the direction I needed for my
> code.
>
> I got it working and added an extra condition to close the layer if I
> clicked on an actionable item within the pop-up (i.e. close img button
> and/or form buttons).
>
> On Aug 24, 1:36 pm, "Richard D. Worth" <[EMAIL PROTECTED]> wrote:
>
> > On 8/24/07,gr00vy0ne<[EMAIL PROTECTED]> wrote:
>
> > > Thanks for the info. Will the window bind work for me?
>
> > > My understanding is that with "window bind" a click anywhere
> > > (including the pop-up layer) will make the layer disappear. How would
> > > I exclude my pop-up layer from disappearing?
>
> > One option is compare the target property of the click event:
>
> > $(window).bind('click', function(ev) {
> >   if ($(ev.target).is('#myDiv'))
> >     //don't close
> >   else
> >     //close
>
> > })
>
> > of course ev.target could be a child of #myDiv, so in that case you might
> > want to add a parents() check:
>
> > if ($(ev.target).is('#myDiv') || $(ev.target).parents('#myDiv').length)
>
> > All untested, but gives you an idea.
>
> > - Richard

Reply via email to