Modify ↓
Ticket #11096 (closed bug: duplicate)
$(window).on not working on IE
| Reported by: | bastien | Owned by: | |
|---|---|---|---|
| Priority: | low | Milestone: | None |
| Component: | event | Version: | 1.7.1 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
I can't catch events in IE (<=8) if I attach it to the $(window) element, can be checked here : http://www.jquery-css.com/test-on or here is the sample code
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Test $(window).on</title>
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript" ></script>
</head>
<body class=""><a style="font-size:23px" href="kjfsdlkfj">go to 404 if buggy</a>
<script type="text/javascript">
$(document).ready(function() {
//bind navigate to clicks
$(window).on("click", 'a', function(e) {
alert('click');return false;
});
});
</script>
</body>
</html>
Change History
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.
Note: See
TracTickets for help on using
tickets.

ok I saw this is duplicate to bug http://bugs.jquery.com/ticket/10928
Why will i do $(window).on : besause a $('body').html(anotherAjaxElement.html()) remove all the events in ie,
so That was important or to fix the $(window).on or to fix the $('body').html() that remove the event binding on body, I then gonna make the other bug to isolate the bug. Anyway, I don't understand why that would be bad to do $(window).on anyway cause in an ajax navigation website that make sense.