Chris Kooken
Chris Kooken

Reputation: 33880

JQuery Delegate IE8

I have a pop-up menu that gets hidden when someone clicks elsewhere on the page.

$(window).delegate("body", 'click', hide);

This works everywhere except IE8. Is there something I am doing wrong?

Upvotes: 0

Views: 1013

Answers (1)

Brandon
Brandon

Reputation: 39192

Do you really need delegate in this case?

$("body").on("click", hide);

For what it's worth, I think the original code is failing because in IE8 events do not bubble all the way up to the window object. $(window.document).delegate("body", "click", hide) might work if you really want to use delegate.

Upvotes: 3

Related Questions