Working example of jeditable and autocomplete working together

前端 未结 6 2278
无人共我
无人共我 2021-02-10 18:54

I see a lot of google posts on this but all seems to be talking about how this is in progress. Does anyone know of a working version of jeditable and autocomplete functionality

6条回答
  •  野的像风
    2021-02-10 19:39

    This is exactly what Jeditable custom inputs are for. Check quick and dirty working demo (start typing something starting with letter a).

    Demo was done in 5 lines of code. It uses Jörn Zaefferer's Autocomple plugin for autocompletion:

    $.editable.addInputType('autocomplete', {
        element : $.editable.types.text.element,
        plugin : function(settings, original) {
            $('input', this).autocomplete(settings.autocomplete.data);
        }
    });
    

    Then you can call Jeditable with something like:

    $(".autocomplete").editable("http://www.example.com/save.php";, {
        type      : "autocomplete",
        tooltip   : "Click to edit...",
        onblur    : "submit",
        autocomplete : {
            multiple : true,
            data     : ["Aberdeen", "Ada", "Adamsville", "Addyston", "Adelphi", "Adena", "Adrian", "Akron"]
        }
    });
    

提交回复
热议问题