jQuery in place edit is now close to have all features it needs. Add some more and it will become feature creep. Most features are configurable. You can even get full control on Ajax request. Just write your own function for submitting and post to this function instead of URL. Smartypants!.
As usual, download latest source or test online.
Now you can define optional callback function. This function is called after form has been submitted. Callback function receives two parameters. Value contains submitted form content. Settings contain all plugin settings. Inside function this refers to the original element.
$(".editable").editable("http://www.example.com/save.php", {
type : "textarea",
submit : "OK",
}, function(value, settings) {
console.log(this);
console.log(value);
console.log(settings);
});
Parameters passed are now same as with callback. Example below does not do anything useful. It only demonstrates available parameters.
$(".editable").editable(function(value, settings) {
console.log(this);
console.log(value);
console.log(settings);
return(value);
}, {
type : "textarea",
submit : "OK",
});
Note that function must return string. Usually the edited content. This will be displayed on page after editing is done.
New features:
Bugs fixed:
Tagged with: Javascript Jeditable Jquery