| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
|
|---|
| 2 | <html>
|
|---|
| 3 | <head>
|
|---|
| 4 | <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
|---|
| 5 | <title>jQuery bind() breaks event.preventDefault()</title>
|
|---|
| 6 | <script src="jquery.js"></script>
|
|---|
| 7 | <script>
|
|---|
| 8 | $(function() {
|
|---|
| 9 | var j = $('#input1');
|
|---|
| 10 |
|
|---|
| 11 | j[0].addEventListener('click', function(event) {
|
|---|
| 12 | event.preventDefault();
|
|---|
| 13 | }, false);
|
|---|
| 14 |
|
|---|
| 15 | j.bind('click', function(event){}); //causing preventDefault() to be ineffective
|
|---|
| 16 |
|
|---|
| 17 | });
|
|---|
| 18 | </script>
|
|---|
| 19 | </head>
|
|---|
| 20 | <body>
|
|---|
| 21 | <input id="input1" type="checkbox"/><label for="input1">preventDefault() should prevent it from being checked.</label>
|
|---|
| 22 | </body>
|
|---|
| 23 | </html>
|
|---|