Since in JQuery, the submission form looks like the following:
$('#yigeform').submit()
So, it is taken for granted that resetting the form is like this:
$('#yigeform').reset()
But, unfortunately, this If you write, there will be a very depressing result, that is, the form cannot be reset!
Later, I checked online and found out that there is no reset method in JQuery. After checking, it turns out that there is no reset method.
So is there no way to reset the form through JQuery? The answer is yes, but it is an indirect method, as follows:
$('#yigeform')[0].reset()
That is, the form is reset by calling the reset method in the DOM.
Statement:The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn