Fixes Uncaught TypeError: $(...).select2 is not a function

The error occured when trying to create a dmsf link. In such a case
select2 must be used in a javascript snippet after jquery and the
select2 plugin are loaded.

Adding the 'document ready' function ensures that everything is loaded
properly before the inline javascript will be executed.
This commit is contained in:
Liane Hampe 2023-08-15 16:03:44 +02:00
parent eb291db7b0
commit 2543f6a1a6

View File

@ -110,8 +110,8 @@
</div>
</div>
<% end %>
<%= late_javascript_tag do %>
$(document).ready(function(){
<%# Select2 extension, TODO: in case of a modal window, select2 makes problems %>
<% unless modal || @fast_links %>
$('#dmsf_link_target_project_id').select2();
@ -148,4 +148,5 @@
labelUrl.append('<span class="required"> *</span>');
}
});
});
<% end %>