Sha256: 103e070bdd4c7f0c8317680013139009d825134bb71b9d2583dc6cf89333d2b7

Contents?: true

Size: 763 Bytes

Versions: 1

Compression:

Stored size: 763 Bytes

Contents

//= require intlTelInput/intlTelInput-jquery
//= require intlTelInput/utils

(function ($) {
  $(document).on('ready page:load turbolinks:load', function () {
    $('[data-intl-tel-input]').each(function () {
      var element = $(this);
      if (element.attr('data-intl-tel-input-init')) {
        return;
      }
      element.attr('data-intl-tel-input-init', 'true');
      var hidden = $('<input type="hidden"/>')
        .attr('name', element.attr('name'))
        .val(element.val())
        .insertAfter(element);
      element.intlTelInput(element.data('intl-tel-input') || {});

      element.removeAttr('name')
        .closest('form').submit(function () {
          hidden.val(element.intlTelInput('getNumber'));
        });
    });
  });
})(jQuery);

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rails-intl-tel-input-0.1.3 app/assets/javascripts/intlTelInput.js