Friday, March 28, 2014

Copying the value of input field in one form to another form

This snippet copies the value of input field #source to another form #hiddenForm.
function copyFieldToForm(source, hiddenForm) {
    var clone = source.clone();
    source.after(clone).appendTo(hiddenForm);
}

copyFieldToForm($("#source"), $("#hiddenForm"));

No comments:

Post a Comment