🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
d

dropdown

DOM mechanism for filling and navigating a dropdown

0.2.0
latest
72

Supply Chain Security

100

Vulnerability

81

Quality

76

Maintenance

100

License

AI-detected possible typosquat

Supply chain risk

There is a package with a similar name that is downloaded much more often.

Did you mean

@preline/dropdown

Unpopular package

Quality

This package is not very popular.

Found 1 instance in 1 package

Version published
Weekly downloads
92
-39.87%
Maintainers
1
Weekly downloads
 
Created
Issues
0

dropdown

Dropdown helper.

Usage

<input id="query" autocomplete="off">
<script>
  var query_el = document.getElementById('query');
  var dropdown = Dropdown.attach(query_el)
    .on('change', function(query) {
      // suppose query == 'ch'
      $.getJSON('/search', {q: query}, function(data, textStatus, jqXHR) {
        // data looks like [{label: 'Charles', value: 'Charles'}, {label: 'Chris', value: 'chris'}, ...]
        dropdown.setOptions(data);
      });
    })
    .on('select', function(value) {
      query_el.value = value;
    });
</script>
<style>
  .dropdown {
    margin: 0 2px;
    padding: 0;
    list-style: none;
    border: 1px solid #CCC;
  }
  .dropdown li {
    padding: 1px;
    cursor: default;
  }
  .selected {
    background-color: pink;
  }
</style>

TODO

  • keep track of mouseover vs. up-down arrow selection, and revert to keyed up-down selection on mouseout.

License

Copyright 2011-2014 Christopher Brown. MIT Licensed.

FAQs

Package last updated on 20 May 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts