views:

48

answers:

1

I have a textarea that I'm able to edit with the jeditable plugin but I do not want the OK and Cancel buttons. I am, instead, going to save the text by clicking away from the textarea (blur). I have that code ready to go but I do not know how to make it work.

+3  A: 

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

Marcos Placona
You can omit "cancel" if you don't want the Cancel button, but the user will need to know to hit ESC if they don't want the changes persisted.
tvanfosson
And that's why I left it in there, and just removed the submit :-)
Marcos Placona
Thank you VERY much mplacona. I completely missed the onblur
Adam
I'd advise you to marl the answer as responded then, so it can be used for future reference.Glad it helped you
Marcos Placona