| 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 | <title>Test</title> |
|---|
| 5 | <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script> |
|---|
| 6 | <script type="text/javascript"> |
|---|
| 7 | $(document).ready(function(){ |
|---|
| 8 | var clone=$("#form1").clone(true); |
|---|
| 9 | clone.find('input[type=submit]').click(function(){ |
|---|
| 10 | alert("click: textarea value:"+$(this).parent('form').find('textarea').text()); |
|---|
| 11 | }); |
|---|
| 12 | clone.submit(function(){ |
|---|
| 13 | alert("submit: textarea value:"+$(this).find('textarea').text()); |
|---|
| 14 | }); |
|---|
| 15 | clone.insertAfter($("#form1")); |
|---|
| 16 | |
|---|
| 17 | }); |
|---|
| 18 | </script> |
|---|
| 19 | </head> |
|---|
| 20 | <body> |
|---|
| 21 | <form id="form1" method="post" action=""> |
|---|
| 22 | <textarea rows="5" cols="20" name="text">mytext</textarea> |
|---|
| 23 | <input type="submit" value="ok"/> |
|---|
| 24 | </form> |
|---|
| 25 | </body> |
|---|
| 26 | </html> |
|---|