| 1 | <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" |
|---|
| 2 | "http://www.w3.org/TR/html4/strict.dtd"> |
|---|
| 3 | <html> |
|---|
| 4 | <head> |
|---|
| 5 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> |
|---|
| 6 | <meta name="author" content="Ian Eure <ieure@socialplatform.com>"> |
|---|
| 7 | <title>jQuery clone() testcase</title> |
|---|
| 8 | <!-- |
|---|
| 9 | <script type="text/javascript" src="jquery-1.2.1.pack.js"></script> |
|---|
| 10 | --> |
|---|
| 11 | <script type="text/javascript" src="jquery-1.2.2.pack.js"></script> |
|---|
| 12 | </head> |
|---|
| 13 | <body> |
|---|
| 14 | <button>Test</button> |
|---|
| 15 | |
|---|
| 16 | <h3>Divs</h3> |
|---|
| 17 | <div class="test">Test</div> |
|---|
| 18 | <div class="final">Final</div> |
|---|
| 19 | |
|---|
| 20 | |
|---|
| 21 | <h3>Table</h3> |
|---|
| 22 | <table> |
|---|
| 23 | <tr class="test"><td>Test</td></tr> |
|---|
| 24 | <tr class="final"><td>Final</td></tr> |
|---|
| 25 | </table> |
|---|
| 26 | <script type="text/javascript"> |
|---|
| 27 | $('button').click(function() |
|---|
| 28 | { |
|---|
| 29 | $('div.test:eq(0)').clone().insertBefore('div.final'); |
|---|
| 30 | $('tr.test:eq(0)').clone().insertBefore('tr.final'); |
|---|
| 31 | }); |
|---|
| 32 | </script> |
|---|
| 33 | </body> |
|---|
| 34 | </html> |
|---|