1 | <html> |
---|
2 | <head> |
---|
3 | <title>Testing die() and live() methods</title> |
---|
4 | </head> |
---|
5 | <body> |
---|
6 | Click on the first element - you should just get a message that everything is ok. <br /> |
---|
7 | <a href="some-other-file.html">Some element</a> |
---|
8 | |
---|
9 | <p> |
---|
10 | Ok, click on the button now - it should remove the event *only* from the second element. |
---|
11 | </p> |
---|
12 | |
---|
13 | <div class="someClass"> |
---|
14 | <a href="#">Some other element</a> |
---|
15 | </div> |
---|
16 | <br /> |
---|
17 | <input class="button" type="submit" value="Crash it!" /> |
---|
18 | |
---|
19 | <script type="text/javascript" src="jquery.min.js"></script> |
---|
20 | <script type="text/javascript"> |
---|
21 | $( function(){ |
---|
22 | $('a').live('click', function(){ |
---|
23 | alert('aye-aye! Everything works fine!'); |
---|
24 | return false; |
---|
25 | }); |
---|
26 | |
---|
27 | $('.button').click( function(){ |
---|
28 | $('.someClass a').die('click'); |
---|
29 | alert('OK, click ont he first element now...'); |
---|
30 | return false; |
---|
31 | }); |
---|
32 | }); |
---|
33 | </script> |
---|
34 | </body> |
---|
35 | </html> |
---|