Do you want the data to be saved on the fly? (AJAX and other buzzwords here)
Simply use the "autosave" option, with the function for saving the new data entered.
<script type="text/javascript">
$(document).ready(function() {
$('#save_me').editme({
// REMEMBER dataToSave (call it what you want), else the data cannot be passed to your custom function
'autosave': function(dataToSave) {
// implement any way of saving here... i'm using ajax post in this example
$.post(
'save_data.json',
dataToSave,
function(data) {
// do whatever you want with the data returned
// ...// REMEMBER TO CALL THIS METHOD!
// else the display view is not shown and it will be stuck at the
// edit mode.
$('#save_me').editme('saved');
}
);
}
});
});
</script>
Options
You can easily customize the editme boxes and even add a remove link!
edittext : The text in the edit link. Default is "edit"
removetext : The text in the remove link. Default is "remove"
removeable : Show the remove link? Default is "false" (use booleans)
savetext : The text in the save button. Default is "save"
canceltext : The text in the cancel link. Default is "cancel"
autosave : Pass the function you want to use, if you want to save the data using ajax. The function should accept ONE parameter (the data to save). Example
"Nearly all options used"-example
<script type="text/javascript">
$(document).ready(function() {
$('#most_options').editme({
'edittext':'Edit me!',
'removetext': 'Delete this row',
'removeable':true,
'savetext':'Save for later...',
'canceltext':'Oopsie, cancel!'
});
});
</script>
This will give the following editme field:
Completely styleable!
The editme script adds lots of HTML to give you a good impression. A lot of that has classes on them,
for easier styling.