Skip to main content

Bug Tracker

Side navigation

Ticket #3016: test.html
File test.html, 1.5 KB (added by Jones, June 10, 2008 03:29PM UTC)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
        <title>Test</title>
        <script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
        <script type="text/javascript">
            $(document).ready(function(){
                $("a.clone").click(function () {
                    $("#test_clone_2").empty().append($("#test_clone").clone(true).children());
                });
                
                $("a.clone_fix").click(function () {
                    $('#test_clone textarea').each(function() {
                        $(this).text($(this).val());
                    });
                    
                    $("#test_clone_2").empty().append($("#test_clone").clone().children());
                });
            });
        </script>
    </head>
    <body>
        <p>
            <span id="test_clone">
                <input type="text" name="test_inp" />
                <br />
                <textarea name="test_text" rows="10" cols="20"></textarea>
            </span>
            
            <hr />
            
            <a href="#" class="clone">clone</a> | <a href="#" class="clone_fix">clone fixed</a>
            
            <hr />
            
            <span id="test_clone_2">
            
            </span>
        </p>
    </body>
</html>

Download in other formats:

Original Format