简体   繁体   中英

Having jeditable save when focus is lost?

(How) can I tweak jeditable to save the text when focus is lost from the text area? If you don't supply submit/cancel buttons, then when pressing 'Enter' the content is saved ... but I haven't found how to save the content on focus lost.

You can do this by setting the onblur option, like this:

$('.editable').editable('myPage.php', {
  onblur: 'submit'
});

Inside jEditable this is what happens:

} else if ('submit' == settings.onblur) {
   input.blur(function(e) {
     t = setTimeout(function() { form.submit(); }, 200);
   });
}

There are detils for the onblur option at the bottom of the jEditable post here , just search for "onblur" in the page.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM