Git Product home page Git Product logo

combobox's Introduction

Combobox

Combobox is a JavaScript plugin that will automatically turn a regular ol‘ select element into an autocomplete. It is only 6KB minified and doesn‘t have any dependencies. It comes with some default styles, but provides markup that can be easily customized if needed. It was built with accesibility in mind and makes full use of ARIA attributes and roles to be screen reader friendly.

Getting started

Include the styles in the head of your document.

<link rel="stylesheet" href="https://unpkg.com/select-combobox/dist/combobox.css">

Include the script at the bottom of the body.

<script src="https://unpkg.com/select-combobox/dist/combobox.js"></script>

Add a new <select> element with the class autocomplete.

Make sure your select is wrapped in a container and it has a label within that container.

Example:

<div>
  <label for="example">Example</label>
  <select id="example" class="autocomplete">
    <option value="1">Option one</option>
    <option value="2">Option two</option>
    <option value="3">Option three</option>
  </select>
</div>

View on CodePen

Development

npm install && gulp

combobox's People

Contributors

dfmcphee avatar npmcdn-to-unpkg-bot avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

combobox's Issues

Data load via ajax; calling functions post-load

Hi there,

This is a fantastic little library and does exactly what I need to do, except it expects the data to have been preloaded. We try to load some of our data using ajax to create filtered lists and speed up some of the load times. I may just have missed something when I did I quick look through the code but it looks like the library can only be invoked on page load, not in JS later on. Is this likely to be added (or have I just missed something)?

Eg.

$('#somecombobox').combobox(); or $('.autocomplete').combobox();

Thanks!

Autocomplete on <option> content

I was a bit confused when I used the demo that it doesn't filter results by what is displayed in the dropdown menu, but rather the value of an <option>.

Filtering also by the contents of the <option>s would be neat.

Nice module :-)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.