HTML multiple tag selection input.
- 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/dist/css/multi-select-tag.css">
<script src="https://cdn.jsdelivr.net/gh/habibmhamadi/multi-select-tag/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 and listening to
onchange
event.
new MultiSelectTag('countries', {
rounded: true, // default true
shadow: true, // default false
placeholder: 'Search', // default Search...
onChange: function(values) {
console.log(values)
}
})
Report bugs and suggest feature in issue tracker. Feel free to Fork
and send Pull Requests
.