I used jQuery clone()
to copy a <div>
.
The code then clears any <input>
values in the clone before inserting it back into the DOM using element.val('')
.
However, after clearing the <input>
values, the value
attribute of the new element still has the copied value.
This is demonstrated in the screenshot below. The selected <input>
element shows no text. However, you can see in the markup that the value
attribute still has the value from the original element that was cloned (shown in the previous row).
How can the value
attribute not match what is in the textbox?