javascript - X-Editable bootstrap plugin "hidden" event issue on dynamically added elements -
i cannot x-editable`s "hidden" event work on dynamically added classes (or fields) via js. can manage work if add editable classes straight on html, approach not suitable me. 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 editable's hidden event 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!'); }); });
Comments
Post a Comment