Copy html form element value from one form into another using jquery

$("#SubmitButton").click(function () {
  $(':input[name]', "#searchForm").each(function () {              
    $('[name=' + $(this).attr('name') + ']', "#generateReportForm").val($(this).val())
  })
});

In the above code we have 2 forms with ids: searchForm and generateReportForm. searchForm has SubmitButton inside it as child element and when it's click it will copy all its field values into generateReportForm.
Copy html form element value from one form into another using jquery Copy html form element value from one form into another using jquery Reviewed by Edward Legaspi on Tuesday, June 28, 2011 Rating: 5

No comments:

Powered by Blogger.