Aquarius.component.define('Frontend/Search', function ($element, options) { var defaults = {}; function Search() { } Search.prototype = { init: function () { var self = this; this.$element = $element; this.allergenek = []; this.defaults = defaults; this.options = Aquarius.extend(this.defaults, options); this.events(); }, events: function () { const self = this; this.$element.find('#openSearch').off('click').on('click', function () { self.$element.find('.search-block').addClass('search--active'); }); this.$element.find('#searchClose').off('click').on('click', function () { self.$element.find('.search-block').removeClass('search--active'); }); /** enter */ this.$element.find('#searchInput2').on("keypress", function (e) { $(window).keydown(function (event) { if (event.keyCode == 13) { event.preventDefault(); $('#searchForm2').submit(); return false; } }); }); }, }; return Search; });