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.
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).
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();
});
Using JQuery you could use the on change event.
$('#form_id input').change(function(){
$('#button').show();
});
The button can be hidden in the meantime.
精彩评论