Code Monkey home page Code Monkey logo

jquery-select-filter's Introduction

jQuery Select-Filter

A jQuery plugin to dynamically filter long <select> lists through an input[type="text"] control.

This plugin is forked from a project by Andras Zoltan-Gyarfas.

Demo

See this jsFiddle.

Getting Started

Download the production version or development version of jQuery.Select-Filter.

<script type="text/javascript" src="http://code.jquery.com/jquery.js"></script>
<script type="text/javascript" src="jquery.select-filter.min.js"></script>
<script type="text/javascript">
    $(document).ready(function() {
        $('select.class').selectFilter();
    });
</script>

Examples

Simple Syntax

$('select.class').selectFilter();

Verbose Syntax

Any of the following attributes can be inside a dictionary to `selectFilter()`.  These options highlight jQuery.select-filter's default settings.

$('select.class').selectFilter({
    // Filtering should be case sensitive.
    'caseSensitive': false,

    // The filter box will be cleared when the user presses the Escape key.
    'clearInputOnEscape': true,
    
    // If true, disable any regex the user enters into the search box.
    'disableRegex': true,

    // The class to apply to the filter bar.
    'filterClass': 'filter-bar',

    // The placeholder text for the filter bar.
    'inputPlaceholder': 'type to filter list',
    
    // The minimum number of characters at which to begin the filtering process.
    'minimumCharacters': 3,
   
    // The minimum size attribute (number of rows) for the element this plugin is called upon.
    // If the element is less than this size, its size will be updated accordingly.
    'minimumSelectElementSize': 3,

    // Amount of time to delay filtering (in ms) after a key is pressed.
    'searchDelay': 200,

    // Begin searching (strictly) from the beginning of each <option> of the calling element.
    'searchFromBeginning': false,

    // The width for the select element and its input filter box.
    // If -1, both the select element and its filter box have their size set to the width of
    // the select element before any filtering occurs.
    'width': -1
});

Release History

  • 2013-01-14 -- 0.0.1 -- Initial verison.

License

Authors

Thanks

  • Michael Zimmer for reporting an issue with the demo jsfiddle and hosting a version of the minified script to fix it.

jquery-select-filter's People

Contributors

kfr2 avatar

Watchers

Antoine Goutenoir avatar James Cloos avatar  avatar

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.