Skip to content

Polyfill for replacing datalist inputs with selects in unsupported browsers

License

Notifications You must be signed in to change notification settings

federicobond/small-datalist-polyfill

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

small-datalist-polyfill

Polyfill for implementing HTML5 datalist in unsupported browsers, using a select input as fallback. The polyfill is written in pure JavaScript (no Modernizr or jQuery needed).

Note: it currently submits the associated form when the select changes. You can disable this behavior by setting data-select-submit="true" on the input.

To configure an empty value for the select, set data-select-placeholder on the input.

Installation

Install with component(1):

$ component install federicobond/small-datalist-polyfill

API

enable(force)

Applies the polyfill. Set the force parameter to true to apply it even on supported browsers (useful for testing).

setSelectorEngine(selectorEngine)

Configure the selector engine that the polyfill should use. Defaults to document.querySelectorAll.

Example

var smallDatalistPolyfill = require("small-datalist-polyfill");
smallDatalistPolyfill.setSelectorEngine(qwery);
smallDatalistPolyfill.enable();

License

UNLICENSE

About

Polyfill for replacing datalist inputs with selects in unsupported browsers

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published