This repository has been archived on 2025-01-19. You can view files and clone it, but cannot push or open issues or pull requests.
drupalcampbristol/web/modules/contrib/webform/js/webform.element.select2.js
2017-03-16 15:29:07 +00:00

27 lines
586 B
JavaScript

/**
* @file
* Javascript behaviors for Select2 integration.
*/
(function ($, Drupal) {
'use strict';
/**
* Initialize Select2 support.
*
* @type {Drupal~behavior}
*/
Drupal.behaviors.webformSelect2 = {
attach: function (context) {
$(context)
.find('select.js-webform-select2, .js-webform-select2 select')
.once('webform-select2')
// http://stackoverflow.com/questions/14313001/select2-not-calculating-resolved-width-correctly-if-select-is-hidden
.css('width', '100%')
.select2();
}
};
})(jQuery, Drupal);