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

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -