Skip to content

fanich37/select-project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Select Project

Plugin for customisation <select> element in pure JavaScript.

How to use this plugin

It's simple as that:

  1. Add the minified file in your html document;
  2. Initialize the plugin by this way:
new Select({
  selector: '#select'
});
  1. Also the callBack option is available:
new Select({
  selector: '#select',
  callBack: function() {
    console.log('Hello, new Select');
  }
});
  1. If you need to use value of selected item - it's easy:
new Select({
  selector: '#select',
  callBack: function(item) {
    console.log('You pick item with a value: ' + item.value;
  }
});
  1. During the initialisation the plugin gets all attributes of <option> tag so you can easily get it's value by native js method:
new Select({
  selector: '#select',
  callBack: function(item) {
    console.log('You pick item with a value: ' + item.el.getAttribute('data-value');
  }
});

About

Plugin for customisation <select> element.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published