Set readonly dynamically in tagify

933 Views Asked by At

I am trying to dynamically set the input field tied to tagify as readonly. According to tagify's documentation I thought I should be able to simply do this:

tagify.setReadonly(true);

I am seeing an error message though:

tagify.setReadonly is not a function

Tagify is initiated like this:

var tagify = new Tagify(document.getElementById("Tags"), { whitelist: [] })

I tried other settings, e.g. removeAllTags and they seem to be working fine this fine. Any idea what I could be doing wrong? Thank you very much for your time and help!

1

There are 1 best solutions below

0
On

Use

tagify.setReadonly('set', 'readonly');

You can find it in tagify documentation also. https://github.com/yairEO/tagify/blob/master/src/tagify.js#L979