Comrades who have just started learning HTML may sometimes encounter a problem, which is why the reset button in the editing page always does not work and the data is not cleared? Let’s explain why next.
The Reset object represents a reset button in an HTML form.
Every time the tag appears in an HTML form, a Reset object is created.
When the reset button is clicked, the values of all input elements in the form containing it are reset to their default values. The default value is specified by the HTML value attribute or JavaScript's defaultValue attribute.
The reset button fires the onclick handler before resetting the form, and this handler can be canceled by returning fasle.
See Form.reset() method and Form.onreset event handler.
You can access a reset button by looping through the form's elements[] array, or by using document.getElementById().
is the default value mentioned above. As the name suggests, the edit page is a page where data has been filled in. There is already default data filled in before, which means that the input inside There is a default value in the box but it is not the empty data like the previous add page, so when you click the reset button, it will only return to the original default value you filled in for the first time, and the data will not be cleared.
ps: I will also encounter this problem at the beginning, and I find it impossible to understand it anyway. I hope it can help those who are studying and encounter the same problems as me.