How do you know if a form has changed?

I would like to know if there is anyway I can check if the form has changed.

eg. If one of the inputs has been changed, I would like to display a button to submit the changes.

+2


source to share


3 answers


JQuery has a change event. So let's do something like:

$(document).ready(function() {
    $('form').change(function() {
        # Here you display your button
    }
}

      



Will work great (and your javascript will remain independent of your html).

+7


source


There is an attribute: onchange="JAVASCRIPTFUNCTION();"

JavaScript example:

<form onchange="displayButton();"> </form>

      

...



Full explanation: CLICK (w3schools.com is one of the best resources)

//////////////////////////////////////////////// /////////////////////////////////////////

JQuery example:

$(FORM_ID).change(function(){
    $(BUTTON_ID).show();
});

      

+3


source


Using JQuery you can use the on change event.

$('#form_id input').change(function(){
    $('#button').show();
});

      

At the same time, the button can be hidden.

0


source







All Articles