Skip to content

habibmhamadi/multi-select-tag

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

multi-select-tag

HTML multiple tag selection input.

multi-select-tag demo

Usage

  • Copy and paste the following css link and js script to your html file.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/gh/habibmhamadi/multi-select-tag@3.1.0/dist/css/multi-select-tag.css">
<script src="https://cdn.jsdelivr.net/gh/habibmhamadi/multi-select-tag@3.1.0/dist/js/multi-select-tag.js"></script>
  • Give an id and multiple attribute to your select element.
<select name="countries" id="countries" multiple>
    <option value="1">Afghanistan</option>
    <option value="2">Australia</option>
    <option value="3">Germany</option>
    <option value="4">Canada</option>
    <option value="5">Russia</option>
</select>
  • Call the function and pass the id.
<script>
    new MultiSelectTag('countries')  // id
</script>
  • You can pass a second optional paramater for border-radius, shadow, placeholder, tag color and listening to onchange event.
new MultiSelectTag('countries', {
    rounded: true,    // default true
    shadow: true,      // default false
    placeholder: 'Search',  // default Search...
    tagColor: {
        textColor: '#327b2c',
        borderColor: '#92e681',
        bgColor: '#eaffe6',
    },
    onChange: function(values) {
        console.log(values)
    }
})

Contribute

Report bugs and suggest feature in issue tracker. Feel free to Fork and send Pull Requests.

License

MIT

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published