jquery jeditable without OK and Cancel Buttons

不羁的心 提交于 2019-12-01 08:54:01

Simply add this to the hash with the settings:

onblur   : 'submit'

Example:

$(document).ready(function() {
    $("#editable1").editable("http://www.domain.com/editdata/", { 
        indicator : "<img src='img/indicator.gif'>",
        type      : 'textarea',
        onblur    : 'submit',
        tooltip   : 'Click to edit...',
        cancel    : 'Cancel'
    });
});

Hope it helps,

Cheers

For those that might be struggling with mobile support due to onblur being triggered prematurely, and need a programmatic way to "cancel" the edit. I added the snip-it below to the start of the jquery.jeditable.js file, under the if('destroy' == target) block.

if ('cancel' == target) {
        //original.reset();
        if ($.isFunction($.editable.types[settings.type].reset)) {
            var reset = $.editable.types[settings.type].reset;
        } else {
            var reset = $.editable.types['defaults'].reset;
        }
        reset.apply(form, [settings, original]);
        return;
    }

It wouldn't be to difficult to modify this into a submit function as well.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!