当前位置:网站首页>JS reset form

JS reset form

2022-06-23 17:40:00 It workers

Usually many forms have a “ Reset ” Button , Although now I see it being used less and less .

reset A button is an input element ,type=”reset”:

<input type="reset">

You can also use JavaScript Programmatically reset form .

All you need is a form element reference :

const form = document.querySelector('form')

Next call reset Method :

form.reset()

This will clear all the elements in the form , And restore them to their original state .

原网站

版权声明
本文为[It workers]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/01/202201061849383492.html