loading libraries in generic javascript view and structuring code


I am trying to use a generic js view to build a dropdown with search bar. I have seen other forums that mention how to use specific js libraries but I just can’t get this to work. Granted I am very new to js but I can’t seem to understand how to replicate from those other examples.

Trying to use select2 which has a pretty simple example (below) but again just don’t know how to get this working.

From select2 (link):

<select class="js-example-basic-single" name="state">
  <option value="AL">Alabama</option>
  <option value="WY">Wyoming</option>

// In your Javascript (external .js resource or <script> tag)
$(document).ready(function() {

Appreciate any help!!

Hello @yc736 ,

welcome to the Forum!

I can see this was your first post, so I assume you are a kind of new here. Did you know about our Hub, where you can find many example workflows in many topics?
I have found this that I believe will be a good one for you here as an inspiration:

Good luck!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.