Magento 2 – How to Reset Form After Submission Using AJAX

ajaxformsmagento2magento2.2

How to reset a form after submission (which is submitted using ajax)?

Best Answer

You can place this code in your AJAX response success

$(':input','#YourFormId')
     .not(':button, :submit, :reset, :hidden')
     .val('')
     .removeAttr('checked')
     .removeAttr('selected');