How to Copy Form Values to 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.

0 Comments

Post a Comment

Post a Comment (0)

Previous Post Next Post
NERV Open Source
Building production Spring Boot systems?

Explore NERV — open-source Java libraries for audit trails, persistence, exception handling, and reliable event-driven architecture.