Wow, that was sooo simple. Works like a charm!
Impressive.. Now, thats the way a plugin should work.
Nice work Mike.
-jl
On Nov 12, 7:04 am, Mika Tuupola <[EMAIL PROTECTED]> wrote:
> 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 Tuupolahttp://www.appelsiini.net/