Search code examples
jqueryx-editable

Switching xeditable off and on using editable("destroy");


I am trying to turn xeditable on and off using editable("destroy"). Xeditable turns off but does not turn back on. The function looks like this:

$("#changeType").on("change", function () {
    switch ($(this).prop("checked")) {
        case true:
            $("#status").editable("destroy");
            $("#status").editable({
                showbuttons: false,
                onblur: 'ignore',
                mode: 'inline',
                send: 'never',
                success: function (params) {
                    return false;
                }
            }).editable('show');
            break;
        case false:
            ("#status").editable("destroy");
            ("#status").editable();
            break;
    };
});

Please see my jsfiddle http://jsfiddle.net/ykay/vdoz07qz/3/


Solution

  • There is a typo (missing $ sign) in your case false:

    $("#status").editable("destroy");
    $("#status").editable();