Home > Article > Web Front-end > How to implement form cancellation function? _html/css_WEB-ITnose
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
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