I am using tagify.js plugin where you can add tags into an input. I have 2 modals, each contains an input where you can add usernames as tags.
<input class="form-control" name="tags"></input>
As the attribute name can be added to multiple inputs not necessary must be unique as id attribute, I kept the name="tags" in both modal.
The problem is when I apply the plugin and add tags to the inputs it's applied only to the input of first modal and not the second.
As you see in the screenshot, in first modal I can select tags inside the input but in the second modal it's empty.

The function I created doesn't generate any error. I tried console.log each variable I have but I couldn't figure out where the issue is.
Any suggestions please what am I doing wrong ? Thank you very much.
Here is my running example. I added comments for better understanding.
As the attribute name can be added to multiple inputs not necessary must be unique as id attribute, I kept the name="tags" in both modal.this is "usually" accomplished by using the "class" property to group like things together.