Search code examples
jquerydjangonpm

Using jquery-editable-select in a Django App


This is my very first Django app so please don't be too harsh :-)

I'm trying to use jquery-editable-select in my Django web App but I'm lost.

https://github.com/indrimuska/jquery-editable-select

According to this link, it seems like I need to install NPM first or Bower.

I don't know what these are, can someone give me the basics from scratch ? Is it something to install via PIP like a python package ?


Solution

  • Just following the instructions on GitHub, this is as easy as loading the libraries. One option is to use those available on Github:

    //rawgithub.com/indrimuska/jquery-editable-select/master/dist/jquery-editable-select.min.js
    

    The other methods (npm/bower/git) allow you to download the libraries to your local machine.

    Include this in your Javascript/JQuery code.

    $('#editable-select').editableSelect();
    <script src="//code.jquery.com/jquery-1.12.4.min.js"></script>
    <script src="//rawgithub.com/indrimuska/jquery-editable-select/master/dist/jquery-editable-select.min.js"></script>
    <link href="//rawgithub.com/indrimuska/jquery-editable-select/master/dist/jquery-editable-select.min.css" rel="stylesheet">
    
    <select id="editable-select">
      <option>Alfa Romeo</option>
      <option>Audi</option>
      <option>BMW</option>
      <option>Citroen</option>
    </select>