diff --git a/js/MultipleSelectStatesHack.js b/js/MultipleSelectStatesHack.js
index e64be86..178bcc2 100644
--- a/js/MultipleSelectStatesHack.js
+++ b/js/MultipleSelectStatesHack.js
@@ -3,11 +3,11 @@
  * Contains a workaround for drupal core issue #1149078.
  */
 
-(function ($) {
+(function (Drupal, $, once) {
   'use strict';
   function select_or_other_check_and_show($select, speed) {
-    var $select_id = $select.attr('id').replace('select', 'other').replace('edit-field-', '')
-    var $other = $(`.js-form-item-field-${$select_id}`)
+    let $select_id = $select.attr('id').replace('select', 'other').replace('edit-field-', '');
+    let $other = $(`.js-form-item-field-${$select_id}`);
     if ($select.find("option:selected[value=select_or_other]").length) {
       $other.show(speed, function () {
         if ($(this).hasClass('select-or-other-initialized')) {
@@ -30,8 +30,8 @@
    */
   Drupal.behaviors.select_or_other = {
     attach: function (context) {
-      $(".js-form-type-select-or-other-select", context).once().each(function () {
-        var $select = $('select', this);
+      $(once("select-or-other", ".js-form-type-select-or-other-select")).each(function () {
+        let $select = $('select', this);
         // Hide the other field if applicable.
         select_or_other_check_and_show($select, 0);
         $select.addClass('select-or-other-initialized');
@@ -47,4 +47,4 @@
     }
   };
 
-})(jQuery);
+}(Drupal, jQuery, once));
diff --git a/select_or_other.libraries.yml b/select_or_other.libraries.yml
index 29d7059..290c2d3 100644
--- a/select_or_other.libraries.yml
+++ b/select_or_other.libraries.yml
@@ -3,4 +3,5 @@ multiple_select_states_hack:
     js/MultipleSelectStatesHack.js: {}
   dependencies:
     - core/drupal
+    - core/once
     - core/jquery
