bernat / best_in_place

A RESTful unobtrusive jQuery Inplace-Editor and a helper as a Rails Gem
http://blog.bernatfarrero.com/in-place-editing-with-javascript-jquery-and-rails-3/
1.2k stars 574 forks source link

Add event that enables JavaScript to be executed on new input #558

Closed thiago-negri closed 7 years ago

thiago-negri commented 7 years ago

When user triggers Best In Place and it creates the new input, I would like to add some jQuery plugins to add masked input to it. In order to do so, I need to execute JavaScript on the newly created input.

Adding some events that we could bind to would solve this, e.g.

$(document).on('turbolinks:load', function() {
  $('[data-bip]').on('bip:activated', function() {
    $(this).find('input').maskedInput(...);
  });
});
thiago-negri commented 7 years ago

There is already an event for this, best_in_place:activate