Override Reset form behavior when data is updated via ajax

I rely on the behavior of the “Reset” form to undo changes, the problem I encountered is that after publishing data via ajax, reset still reverts to the data that was downloaded from the original page.

So basically what I need is the "Reset" function "Reset". It makes sense?

+3
source share
3 answers

Try the following:

$("#yourForm").bind("reset", function() {

    // reset the form manually with the "newest" data

    return false;
});

In this case, you will need to save the new data (obtained by you from the Ajax callback). And then, when the user resets the form, you manually fill in the form elements with this data.

+4

.

.

:

DefaultValue ( , )
defaultChecked (, )
defaultSelected ()

, , reset(): (, , ) .

+3

, - Reset , HTML-. , AJAX - (.. ) Reset, ( ) .

0

Source: https://habr.com/ru/post/1772413/


All Articles