瀏覽代碼

Fix JS loading in autocomplete form type (#4610)

Trigger the select2-JavaScript code at onload event
Julien Chichignoud 7 年之前
父節點
當前提交
b2b39d5cd2
共有 1 個文件被更改,包括 2 次插入2 次删除
  1. 2 2
      Resources/views/Form/Type/sonata_type_model_autocomplete.html.twig

+ 2 - 2
Resources/views/Form/Type/sonata_type_model_autocomplete.html.twig

@@ -37,7 +37,7 @@ file that was distributed with this source code.
     </div>
 
     <script>
-        (function ($) {
+        jQuery(function ($) {
             // Select2 v3 does not used same input as v4.
             // NEXT_MAJOR: Remove this BC layer while upgrading to v4.
             var usedInputRef = window.Select2 ? '#{{ id }}_autocomplete_input' : '#{{ id }}_autocomplete_input_v4';
@@ -237,6 +237,6 @@ file that was distributed with this source code.
                 $(usedInputRef).remove();
                 return true;
             });
-        })(jQuery);
+        });
     </script>
 {% endspaceless %}