Bug Tracker

Modify

Ticket #11096 (closed bug: duplicate)

Opened 17 months ago

Last modified 17 months ago

$(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

comment:1 Changed 17 months 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 17 months ago by sindresorhus

  • Priority changed from undecided to low
  • Resolution set to duplicate
  • Status changed from new to closed
  • Component changed from unfiled to event

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

comment:3 Changed 17 months ago by sindresorhus

Duplicate of #10928.

Please follow the  bug reporting guidlines and use  jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

View

Add a comment

Modify Ticket

Action
as closed
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.