Pretty Select Box Replacemenet With Pure JavaScript – tastySelect

Category: Form , Javascript , Recommended | February 13, 2018
Author: jekyenin
Views Total: 235
Official Page: Go to website
Last Update: February 13, 2018
License: MIT

Preview:

Pretty Select Box Replacemenet With Pure JavaScript – tastySelect

Description:

tastySelect is a JavaScript plugin to create animated, pretty nice, multi-select dropdown list without any dependencies.

Basic Theme:

tastySelect Basic Theme

How to use it:

Import the tastySelect’s JavaScript and Stylesheet into the webpage.

<link rel="stylesheet" href="tastySelect.css">
<script src="tastySelect.min.js"></script>

Create a normal ‘multiple’ select element as these

<select name="" id="tastySelect" multiple>
  <optgroup label="JavaScript">
    <option value="jQuery">jQuery</option>
    <option value="React">ReactJS</option>
    <option value="Angular">AngularJS</option>
  </optgroup>
  <optgroup label="HTML">
    <option value="HTML5">HTML 5</option>
    <option value="XML">XML</option>
    <option value="XHTML">XHTML</option>
  </optgroup>
  <option value="css">CSS/SCSS/LESS</option>
  <option value="more">More Options Here</option>
</select>

Initialize the tastySelect library and done.

tastySelect({
  defaultText: "Select Multiple Options Via (Ctrl+Click)"
});

More configuration options with default values.

tastySelect({
  selector: 'select',
  mobileFix: true,
  mask: '%',
  maskJoin: ', ',
  defaultText: 'Select item...',
  classes : {
    outer: 'style-select',
    title: 'style-select-title',
    options: 'style-select-options',
    label: 'style-select-label',
    optgroup: 'style-select-optgroup',
    list: 'style-select-list',
    item: 'style-select-option',
    open: 'st_open',
    selected: 'st_selected',
    mobile: 'is_mobile',
  },
  attributes : {
    index: 'data-index',
    value: 'data-value',
    selectReady: 'data-tastyselect',
  },
});

Leave a Reply