tags:

views:

135

answers:

3

I Would like to know if there is anyway I can check if a form has been modified.

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

+3  A: 

There is a attribute called: onchange="JAVASCRIPTFUNCTION();"

JavaScript Example:

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

.

Full explaination: CLICK (w3schools.com is one of the best resources out there)

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

jQuery Example:

$(FORM_ID).change(function(){
    $(BUTTON_ID).show();
});
daemonfire300
this is javascript approach not actually jquery
TStamper
@Stamper, right, but i thought doing it by native js is much more easier.
daemonfire300
@daemonfire300- ? how would you think that? but even that the OP asked for jquery. but I didnt downvote you
TStamper
+6  A: 

There's a "change" event with JQuery. So doing something like :

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

Will perfectly work (and your javascript remains independant from your html).

Damien MATHIEU
Read more in the jQuery documentation: http://docs.jquery.com/Events/change
Bauer
A: 

Using JQuery you could use the on change event.

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

The button can be hidden in the meantime.

partoa