admin管理员组文章数量:1425891
I am trying to duplicate a form after it has been filled out. So the user fills out the form then hits submit. then a new window opens with the full html form, images, and styling included AND the values so they can print the filled out version. i tried .html() and .clone(). but neither seem to work.
any help is much apperciated. and please don't hesitate to ask questions.
I am trying to duplicate a form after it has been filled out. So the user fills out the form then hits submit. then a new window opens with the full html form, images, and styling included AND the values so they can print the filled out version. i tried .html() and .clone(). but neither seem to work.
any help is much apperciated. and please don't hesitate to ask questions.
Share Improve this question asked Apr 15, 2011 at 12:15 Steve FischerSteve Fischer 3251 gold badge5 silver badges15 bronze badges 3-
1
clone()
seems to work fine: jsfiddle/fkling/te3LX Maybe you should post your code too. – Felix Kling Commented Apr 15, 2011 at 12:18 -
Correction: It seems only to work for
input
elements. – Felix Kling Commented Apr 15, 2011 at 12:34 - ahh ok. bennadel./blog/… i started with this. maybe it will help – Steve Fischer Commented Apr 15, 2011 at 12:36
2 Answers
Reset to default 3Edit: Post your code for creating the popup.
You may need to use val() to copy the values over. http://jsfiddle/Na6GN/2/
$('#myForm :input').each(function() {
$(this).clone().appendTo('#newForm').val($(this).val());
});
Its working fine:
JS:
$('btnclone').click(function() {
var mywindow = window.open();
$(mywindow.document.body).append($('form').eq(0).clone());
});
Html Code
<form>
<input name='test' />
</form>
<input type="button" value="Clone" name="btnclone" id="btnclone" />
本文标签: javascriptclone html form WITH valuesStack Overflow
版权声明:本文标题:javascript - clone html form WITH values - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1745428394a2658217.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论