How to reset the form after submitting?

I have a simple form, let's say it takes an email address. As soon as the form is submitted, the message stack notifies the user that his address has been sent successfully. The problem is that after sending the address the form field with the email address still contains the email address that was entered by the user, how would I reset this field? Should I use JavaScript for this?

thanks

+3
source share
2 answers
window.onload = function () {
    for(var f in document.getElementsByTagName("form"))
        f.reset();
}

, , , onload, . , ( 2 3). , , JavaScript, .

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

:
​​ jQuery

jQuery: http://jquery.com

+1

Source: https://habr.com/ru/post/1714354/


All Articles