-
Notifications
You must be signed in to change notification settings - Fork 426
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple init Tagify #1336
Comments
To detect dynamically added DOM nodes, please read my answer here: https://stackoverflow.com/a/14570614/104380 I assume you have no idea when are those inputs which are supposed to be Tagified are added, because you would have had them Tagified right after that. Regarding your You do not need to access the function initTagify(el, data = {}){
let opt = {
delimiters: '?'
}
// example
if(el.getAttribute('data-one') == '1'){
opt.mode = 'select';
}
// set some option
if(el.getAttribute('data-bla_bla') == '1'){
opt.some_prop = 'some_value';
}
// init
let tagifyItem = new Tagify(el, opt);
if(el.getAttribute('data-suggest'))
tagifyItem.on('input', onTagifyInput);
}
function onTagifyInput(e) {
tagify = e.detail.tagify
tagify.whitelist = null
requestTagifySuggest(tagify, {'e' : e, 'type' : 'getProducts' })
} |
Hi, is best of the best component)
There are two questions.
1. Multiple init Tagify.
There are many Tagify elements on the page, also dynamic ones. Writing initialization code for each is not very good.
Wrote and sampled the function:
then on dom load
If write to input have error in console
I probably approached the problem incorrectly or wrote the code incorrectly, please tell me how to organize such an idea correctly?
2. Second question , reinit Tagify
The text was updated successfully, but these errors were encountered: