Transforms an input field or a textarea into a Tags component, in an easy, customizable way, with great performance and small code footprint, exploded with features For full documentation please check the plugin's site.
Usage
Tagify's CSS and Javascript files are bundled in the global plugin bundles and globally included in all pages:
// The DOM elements you wish to replace with Tagify
var input1 = document.querySelector("#kt_tagify_1");
var input2 = document.querySelector("#kt_tagify_2");
// Initialize Tagify components on the above inputs
new Tagify(input1);
new Tagify(input2);
// The DOM elements you wish to replace with Tagify
var input1 = document.querySelector("#kt_tagify_3");
var input2 = document.querySelector("#kt_tagify_4");
var input2 = document.querySelector("#kt_tagify_5");
// Initialize Tagify components on the above inputs
new Tagify(input1);
new Tagify(input2);
new Tagify(input3);
// The DOM elements you wish to replace with Tagify
var input = document.querySelector("#kt_tagify_6");
var input = document.querySelector("#kt_tagify_7");
// Initialize Tagify script on the above inputs
new Tagify(input, {
whitelist: ["Ada", "Adenine", "Agda", "Agilent VEE"],
maxTags: 10,
dropdown: {
maxItems: 20, // <- mixumum allowed rendered suggestions
classname: "tagify__inline__suggestions", // <- custom classname for this dropdown, so it could be targeted
enabled: 0, // <- show suggestions on focus
closeOnSelect: false // <- do not hide the suggestions dropdown once an item has been selected
}
});
new Tagify(input, {
whitelist: ["Ada", "Adenine", "Agda", "Agilent VEE"],
maxTags: 10,
dropdown: {
maxItems: 20, // <- mixumum allowed rendered suggestions
classname: "", // <- custom classname for this dropdown, so it could be targeted
enabled: 0, // <- show suggestions on focus
closeOnSelect: false // <- do not hide the suggestions dropdown once an item has been selected
}
});
If the original input field has a readonly attribute, then, via CSS, there will be no way of manually adding tags because the inline contenteditable element will be hidden.
// The DOM elements you wish to replace with Tagify
var input1 = document.querySelector("#kt_tagify_8");
// Initialize Tagify components on the above inputs
new Tagify(input1);