javascript - jQuery clone() problem -


i using jquery clone form input field when user click on add button goes fine, have problem if write in form input field , click add button, jquery copy text new cloned input element also.

you can try demo: http://jsbin.com/ikebil/2/edit

steps:

  1. open link , click render

  2. type in input field

  3. click on add button create new input field copy text written in previous one.

original code: http://charlie.griefer.com/blog/2009/09/17/jquery-dynamically-adding-form-elements/

so need remove text comes if written in previous element.

the best solution make copy of element before it's being populated data, , use "safe" copy , clone it.
it's faster , safer => see working example


Comments

Popular posts from this blog

c# - How to set Z index when using WPF DrawingContext? -

razor - Is this a bug in WebMatrix PageData? -

visual c++ - Using relative values in array sorting ( asm ) -