Skip to main content

Bug Tracker

Side navigation

Ticket #2613: jquery_bind_breaks_preventDefault.html


File jquery_bind_breaks_preventDefault.html, 0.7 KB (added by arrix, March 29, 2008 04:27AM UTC)
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
		<title>jQuery bind() breaks event.preventDefault()</title>
		<script src="jquery.js"></script>
		<script>
		  $(function() {
		    var j = $('#input1');
								
				j[0].addEventListener('click', function(event) {
					event.preventDefault();
				}, false);
				
				j.bind('click', function(event){}); //causing preventDefault() to be ineffective

		  });
		</script>
	</head>
	<body>
		<input id="input1" type="checkbox"/><label for="input1">preventDefault() should prevent it from being checked.</label>
	</body>
</html>

Download in other formats:

Original Format