This jQuery plugin is used to control various element in a form. When the end user changes values of input elements, the plugin shows which element where changed, and alerts the user that he has to submit the changes before doing other actions (e.g.: move out of the page)
Tested in Firefox 4+, Google Chrome 10+, Safari 5+, Internet Explorer 8+.
v0.1
- Fixed bug in windowEvent: now the plugin catches changes in the form without needing to submit data at first
$(document).ready(function(){
$('#myform').lookUp();
});
<form id="myform">
<input type="text" value="here's default value" />
<input type="submit" value="save" />
</form>
show user the changes, by adding class 'changed' to the css:
<style>
.changed {
color: #B94A48;
background-color: #F2DEDE;
border-color: #EED3D7;
}
</style>
All options override default values.
changeClass
Change class for modified elements, default value is 'changed'.
$(document).ready(function(){
$('#myform').lookUp({
changeClass: "alert-color"
});
});
msg
Change confirm message.
$(document).ready(function(){
$('#myform').lookUp({
msg: "Le modifiche non salvate verranno perse. Pazzo!"
});
});
windowEvent
Enable/Disable window event handling, by default disabled.
$(document).ready(function(){
$('#myform').lookUp({
windowEvent: true
});
});