On Nov 12, 2008, at 10:28 AM, Mika Tuupola wrote:
On Nov 12, 2008, at 1:46 AM, [EMAIL PROTECTED] wrote:
I was wondering if it my be possible to add autocomplete
functionality
using the addInputType API. It looks like it might be possible to
attach autocomplete to the text input through the "element:" argument
when declaring a custom input type.
It should be fairly easy. Usually you just to need to create the
element using "element" and add plugin to it using "plugin".
It is basically 5 lines of code. Quick and dirty autocomplete input
for Jeditable:
-cut-
$.editable.addInputType('autocomplete', {
element : $.editable.types.text.element,
plugin : function(settings, original) {
$('input', this).autocomplete(settings.autocomplete.data);
}
});
-cut-
Then you can call it with something like:
-cut-
$(".autocomplete").editable("http://www.example.com/save.php", {
type : "autocomplete",
tooltip : "Click to edit...",
onblur : "submit",
autocomplete : {
data : ["Aberdeen", "Ada", "Adamsville", "Addyston",
"Adelphi", "Adena", "Adrian", "Akron"]
}
});
-cut-
--
Mika Tuupola
http://www.appelsiini.net/