You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I know there are examples, but I don't seem to be smart enough to figure out what to do.
I'm working on a JavaScript application where users can create notes with tags. I'm using the Tagify library to enhance the tag input functionality.
I'm initializing the Tagify input as follows:
consttagInput=document.querySelector('.note-tags');consttagify=newTagify(tagInput,{whitelist: ['example-tag-1','example-tag-2','example-tag-3'],enforceWhitelist: false,dropdown: {position: 'input',enabled: 0// Always show suggestions}});tagify.addTags(['example-tag-1','example-tag-2']);
I need to toggle this Tagify input between:
Editable mode: Users can add/remove tags.
Non-editable mode: Users cannot modify the tags.
Here’s my attempt to toggle the editable state:
functionsetTagifyEditMode(editable){consttagifyElement=document.querySelector("[class^='tagify']");if(editable){tagifyElement.removeAttribute('contenteditable');tagify.settings.readonly=false;}else{tagifyElement.setAttribute('contenteditable','false');tagify.settings.readonly=true;}tagify.DOM.input.readOnly=!editable;// Updating the settingstagify.update();}// Example usagesetTagifyEditMode(false);// Making the Tagify input non-editable
Despite attempting the changes above, the Tagify input remains editable even in non-editable mode. How can I correctly toggle the Tagify input between editable and non-editable states?
Any guidance or suggestions would be greatly appreciated. Thank you!
The text was updated successfully, but these errors were encountered:
I know there are examples, but I don't seem to be smart enough to figure out what to do.
I'm working on a JavaScript application where users can create notes with tags. I'm using the Tagify library to enhance the tag input functionality.
I'm initializing the Tagify input as follows:
I need to toggle this Tagify input between:
Here’s my attempt to toggle the editable state:
Despite attempting the changes above, the Tagify input remains editable even in non-editable mode. How can I correctly toggle the Tagify input between editable and non-editable states?
Any guidance or suggestions would be greatly appreciated. Thank you!
The text was updated successfully, but these errors were encountered: