Skip to main content

Bug Tracker

Side navigation

Ticket #3704: jquery-clone-test.html


File jquery-clone-test.html, 0.7 KB (added by mikesamuel, December 09, 2008 11:40PM UTC)

HTML testcase

<html>
  <head>
    <title>Cloning inputs : value vs defaultValue.</title>
    <script src="jquery-1.2.5.js"></script>
  </head>
  <body>
    <form><input value="initial"></form>
    <script>(function () {
      var original = document.forms[0].elements[0];

      original.value = 'changed';

      var clone = $(original).clone(true)[0];

      document.writeln('<pre>');
      document.writeln('original.       value=' + original.       value);
      document.writeln('original.defaultValue=' + original.defaultValue);
      document.writeln('   clone.       value=' +    clone.       value);
      document.writeln('   clone.defaultValue=' +    clone.defaultValue);
      document.writeln('<\/pre>');
    })()</script>
    </pre>
  </body>
</html>

Download in other formats:

Original Format