I cannot get x-editable`s "hidden" event to work on dynamically added classes (or fields) via JS. I can manage it to work only if I add editable classes straight on HTML, but this approach is not suitable for me. What am I doing wrong?
$.fn.editable.defaults.mode = "inline";
$.fn.editable.defaults.onblur = "submit";
$(document).ready(function () {
$('.field').each(function() {
$(this).addClass('editable');
});
$('.editable').editable();
});
$(document).on('hidden', '.editable', function(e, params) {
alert('was hidden!');
});
Fiddle: http://jsfiddle.net/4vj8buks/17/
You can hook into the editable's hidden event like this:
$.fn.editable.defaults.mode = "inline";
$.fn.editable.defaults.onblur = "submit";
$(document).ready(function () {
$('.field').each(function() {
$(this).addClass('editable');
});
$('.editable').editable().on('hidden', function (e, params) {
alert('was hidden!');
});
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With