Home >Web Front-end >HTML Tutorial >How to implement form cancellation function? _html/css_WEB-ITnose

How to implement form cancellation function? _html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:13:161307browse

Now my page consists of two divs, div1 displays trust information, div2 is hidden editable details, click the edit button on div1 to hide div1 and display div2 to enter the editing state. If you edit the information on the div2 page, there is no Save and click the Cancel button. If you enter again, the previously edited information will still exist. How can I restore the information to the original details when I click Cancel? In addition to refreshing, is there any simple method? Please heroes think of a way and wait online


Reply to the discussion (solution)

When you click cancel, store the text in the cookie Or ajax sends it to the server and takes it out when performing the next operation. . It is recommended that ajax be used because cookies have size restrictions

When you click cancel, store the text in the cookie or send ajax to the server, and take it out when you perform the next operation. . It is recommended that ajax because the cookie has a size limit
Just use the form.reset(); method. I thought that reset would clear the form. It turns out that reset does not clear the form, and the problem is solved

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