Bug Tracker

Opened 12 years ago

Closed 12 years ago

Last modified 12 years ago

#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:
Blocked by: Blocking:


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

<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>
<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;

Change History (3)

comment:1 Changed 12 years ago by anonymous

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.

comment:2 Changed 12 years ago by sindresorhus

Component: unfiledevent
Priority: undecidedlow
Resolution: duplicate
Status: newclosed

If you're replacing the whole body contents with ajax, you're doing it wrong.

comment:3 Changed 12 years ago by sindresorhus

Duplicate of #10928.

Note: See TracTickets for help on using tickets.