I would like Tagify not to accept characters other than those allowed [e.g. #,@,(,)].
I tried this:
var input = document.querySelector('input'),
tagify = new Tagify(input, {
mode: 'mix', //i would use Tagify in mixed mode.
pattern: /@|#/, //this is my trigger-chars for invoke ajax calls
trim: true
});
tagify.on('input', function(event) {
const allowedChars = ['(',')'];
if (!allowedChars.includes(value)) {
console.log("exit")
return false;
}
// other code
});
But, using the ‘input’ event, the character has already been written to the input.
I tried using ‘change’ but it doesn’t work at all.
Some idea?