1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
---|
2 | <html xmlns="http://www.w3.org/1999/xhtml"> |
---|
3 | <head> |
---|
4 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> |
---|
5 | <title>Clone Test</title> |
---|
6 | |
---|
7 | </head> |
---|
8 | |
---|
9 | <body> |
---|
10 | |
---|
11 | <form id="test" method="post"> |
---|
12 | <textarea id="test_textarea" name="something"></textarea> |
---|
13 | <input type="button" id="clone" value="Clone"></input> |
---|
14 | </form> |
---|
15 | |
---|
16 | <h2>Cloned</h2> |
---|
17 | <form id="cloned" method="post"></form> |
---|
18 | |
---|
19 | <h2>Cloned(true)</h2> |
---|
20 | <form id="cloned_all" method="post"></form> |
---|
21 | |
---|
22 | <script type="text/javascript" src="jquery-1.3.2.min.js"></script> |
---|
23 | <script type="text/javascript"> |
---|
24 | $(document).ready(function(){ |
---|
25 | $("#clone").click(function(){ |
---|
26 | var $text = $("#test_textarea"); |
---|
27 | var $clone = $text.clone(); |
---|
28 | var $clone_all = $text.clone(true); |
---|
29 | |
---|
30 | $("#cloned").html($clone); |
---|
31 | $("#cloned_all").html($clone_all); |
---|
32 | }); |
---|
33 | }); |
---|
34 | </script> |
---|
35 | |
---|
36 | </body> |
---|
37 | </html> |
---|