Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

vanilla-js-dropdown

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

vanilla-js-dropdown

Vanilla JavaScript Dropdown - a tiny (~700 bytes gzipped) select tag replacement with optgroups support.

  • 2.2.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
88
increased by33.33%
Maintainers
1
Weekly downloads
 
Created
Source

Vanilla JavaScript Dropdown - replacement for <select>

Build Status Coverage Status Dependencies

Tiny (0.7 KB gzipped!) JavaScript replacement for <select> that makes styling easy and consistent.

— Inspired by the blazing fast, lightweight, cross-platform and crazy popular Vanilla JS framework.

How it works

Reads the original <select> element's options (with respect of selected, if any), creates and attaches the pseudo-select just before the original one, and hides the original.

Upon selection it updates the original <select>, so when you submit your form the value will be there.

JavaScript disabled? No problem! Nicely degrades to original <select>.

Demo

DROPDOWN

Options

OptionRequiredDescription
elemyesid of the select you want to replace or a direct DOM element

Methods

MethodDescription
.toggle()Opens the select if closed and vice-versa
.close()Closes the select
.open()Opens the select

Usage example

var select = new CustomSelect({
  elem: 'select',
});

// open it for the user
select.open();

Running the tests

npm test

Browser support and dependencies

BrowserSupportDependencies
Chromeyes-
Firefoxyes-
Safariyes-
Operayes-
Edgeyes-
IEyes*Polyfill for .classList in IE9, Polyfill for CustomEvent in IE9+

* IE9 and up

Versioning

This project uses SemVer for versioning. For the versions available, see the tags on this repository.

License

Anyone is free to copy, modify, publish, use, compile, sell, or distribute this software, either in source code form or as a compiled binary, for any purpose, commercial or non-commercial, and by any means.

See Unlicense for full details.

FAQs

Package last updated on 14 Apr 2019

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc