Pure JavaScript (VanillaJS) dropdown menu, with multiple select and searching support

Overview

JS Select

Pure JavaScript (VanillaJS) dropdown menu, with multiple select and searching support

How to use

To use the select plugins, two main file must be included. The stylesheet:

<link rel="stylesheet" href="/js-select/dist/css/select.min.css" />

And the script file (inclusive of all language files)

<script src="/js-select/dist/select.min.js"></script>

The component must follow this structure

<select data-replace="jselect" data-locale="en" data-search="true" data-multiple="false" data-placeholder="Choose">
    <optgroup label="Group 1">
        <option value="loremIpsum" data-img="/path/to/img" data-desc="Lorem ipsum">Lorem ipsum</option>
        <!-- other options -->
    </optgroup>
    <option value="single" data-img="/path/to/img" data-desc="Single">Single</option>
    <!-- other options -->
</select>

Referencing

Once a JSelect has been istantiated, it can be references through the global window.JSELECT_INSTANCES. It is a key-value dictionary, so structured:

  • the key is the JSelect INSTANCE's name. It's the value of the name attribute in the <select> tag, or, if that attribute was empty or not provided, the UNIX timestamp at the time the JSelect was istantiated.

  • the value is the JSelect object.

For example, a JSelect with name = regions, can be referenced through:

var regionsSelect = window.JSELECT_INSTANCES["regions"];

Options

Options for the select tag:

attribute name data type description default
disabled boolean tells if select is disabled false
data-locale string lowercase two-letters ISO language code 'en'
data-search boolean tells if select menu should be searchable false
data-placeholder string placeholder text. If not set, a generic message will be displayed (according to locale) null
data-multiple boolean tells if user can choose multiple options false

Options for the option tag:

attribute name data type description default
disabled boolean tells if option is disabled false
selected boolean tells if option is selected false
data-img string image's path (shown at the left) null
data-desc string option's description (shown at the bottom with muted text color) null

Keyboard shortcuts

If focus isn't on the component, then the Enter key will show the menu. Once it's open, the following shortcuts can be used:

keys description
Enter If multiple, just toggle current option. Else, select current option and close the menu
ArrowUp previous non-disabled option becomes current option. If not multiple, select it
ArrowDown next non-disabled option becomes current option. If not multiple, select it
PageUp first non-disabled option becomes current option. If not multiple, select it
PageDown last non-disabled option becomes current option. If not multiple, select it

Events

Plugin provides custom events to intercept changes either in structure or in value.

event name description
jselect-create let the DOM know that a INSTANCE of JSelect has been created
jselect-change user has changed the value (selected or deselected some options)
jselect-reload component's properties has changed (by JavaScript) thus, component should reload

Languages

At the time I'm writing this document, there are only Italian (it) and English (en) available.
I don't use automatic translators. I prefer filling only languages that I know.
Other translation can be easily added in the /src/locales.js file.
Remeber to use the correct ISO two-letter code. See here

You might also like...

Select creates a dropdown list of items with the selected item in closed view.

Select creates a dropdown list of items with the selected item in closed view.

Native Base Select 🔽 This module includes a customizable multi-select and a single select component for Native Base. The package is both Android and

Dec 25, 2022

A custom select dropdown. This is something that is not too difficult to make.

Custom-Dropdown-JS A custom select dropdown using basic JS fucntionality. This is something that is not too difficult to make. But it shows that you h

Mar 26, 2022

a jquery searchable select dropdown

Select Search A simple jquery search on select options plugin for your website How To Use Just create an html structure that contains select tag e.g.

Sep 25, 2020

Dropdown select box for bootstrap 5

dselect Dropdown select box for bootstrap 5 Demo Features Placeholder Multiple Search Creatable Clearable Sizing Validation Installation Install dsele

Dec 21, 2022

BVSelect-VanillaJS - BVSelect - Vanilla Javascript Fully Customizable SelectBox

BVSelect-VanillaJS - BVSelect - Vanilla Javascript Fully Customizable SelectBox

BVSelect - Vanilla JS Replaces native select elements with fully customizable dropdowns. Demo: https://bmsvieira.github.io/BVSelect-VanillaJS/ Feature

Dec 26, 2022

A utility for creating toggleable items with JavaScript. Inspired by bootstrap's toggle utility. Implemented in vanillaJS in a functional style.

LUX TOGGLE Demo: https://jesschampion.github.io/lux-toggle/ A utility for creating toggleable dom elements with JavaScript. Inspired by bootstrap's to

Oct 3, 2020

Create beautiful, functional and extensive (Multi) Select Fields with pure, vanilla JavaScript.

tail.select.js - Beautify Select Fields (formerly tail.select) Replace and Improve your HTML select fields with style and without jQuery! The tail.s

Dec 30, 2022

A lightweight vanilla JavaScript context menu library with FontAwesome support.

A lightweight vanilla JavaScript context menu library with FontAwesome support.

Contextify A lightweight vanilla JavaScript context menu library with FontAwesome support. This library was written for use in a personal project of m

Jun 1, 2022

🍦 ✨ Simple multi-select pure vanilla Javascript library.

🍦 ✨ Simple multi-select pure vanilla Javascript library.

multiSelect.js ✨ Simple multi-select pure vanilla Javascript library. 🚀 Live Demo v1.0.8 multiSelect.js is a simple, pure vanilla Javascript library

Mar 15, 2022
Owner
Luigi Verolla
Engineering student @ University of Salerno
Luigi Verolla
The jQuery plugin that brings select elements into the 21st century with intuitive multiselection, searching, and much more. Now with Bootstrap 5 support.

bootstrap-select The jQuery plugin that brings select elements into the 21st century with intuitive multiselection, searching, and much more. Now with

SnapAppointments 9.7k Dec 30, 2022
The jQuery plugin that brings select elements into the 21st century with intuitive multiselection, searching, and much more. Now with Bootstrap 5 support

bootstrap-select The jQuery plugin that brings select elements into the 21st century with intuitive multiselection, searching, and much more. Now with

SnapAppointments 9.7k Dec 30, 2022
Converts select multiple elements into dropdown menus with checkboxes

jquery-multi-select Converts <select multiple> elements into dropdown menus with a checkbox for each <option>. The original <select> element is hidden

mySociety 22 Dec 8, 2022
Multiple level dropdown works with Bootstrap 5, just like native support.

Bootstrap 5 Multiple Level Dropdown. For Bootstrap 4, please visit Bootstrap 4 Multiple Level Dropdown Using official HTML without adding extra CSS st

Dallas Lu 17 Dec 13, 2022
Responsive Dropdown Menu Bar

Responsive Dropdown Menu Watch it on youtube Responsive Dropdown Menu Beautiful and clean responsive navigation bar includes a beautiful drop-down sid

Marlon 44 Oct 21, 2022
A library that helps you write a static dropdown menu that follows the digital accessibility recommendations.

JSPanel A library that helps you write a static dropdown menu, a panel, that follows the digital accessibility recommendations. Get started First of a

CodoPixel 1 Apr 29, 2021
This restaurant project is a SPA (single-page application) website. The user can navigate between the home, menu and contact page. I used the MealDB API to display some menu items.

Fresh Cuisine This restaurant project is from the Odin Project and it is a SPA (single-page application) website. The user can navigate between the ho

Virag Kormoczy 7 Nov 2, 2022
jSide Menu is a well designed, simple and clean side navigation menu with dropdowns.

jQuery jSide Menu jSide Menu is a well designed, simple and clean side navigation menu with dropdowns. Browse: Live Demo & Using Guide Main Features F

CodeHim 24 Feb 14, 2022
Obsidian-dataview-table-filter-menu - Dynamically created filter menu for dataview tables in obsidian

Dataview table Filter Menu for Obsidian Dynamically created filter menu for data

shiro 17 Sep 24, 2022
A little animation for a big menu where the letters of a word shuffle to become the first letter of each menu item.

Letter Shuffle Animation for a Menu A little animation for a big menu where the letters of a word shuffle to become the first letter of each menu item

Codrops 29 Dec 4, 2022