"use strict";
(function ($) {
    $.field_emailtype = function (element, options) {
        var defaults = {
            field_name:''
        }
        var plugin = this;
        plugin.settings = {}
        var $element = $(element), 
            element = element;
        plugin.init = function () {
            plugin.settings = $.extend({}, defaults, options);
            let  field_name= plugin.settings.field_name;
            $element.find(`select[name="${field_name}"]`).select2();

        };
        plugin.example_function = function () {
        };
        plugin.init();
    }
    
    $.fn.field_emailtype = function (options) {
        
        return this.each(function () {
            
            if (undefined == $(this).data('field_emailtype')) {
                var plugin = new $.field_emailtype(this, options);
                $(this).data('field_emailtype', plugin);
            }
        });
    }
})(jQuery);