ivirabyan / jquery-mentions

Adds mentioning support to your text fields.
http://ivirabyan.github.io/jquery-mentions/
MIT License
114 stars 49 forks source link

applying to textarea that is dynamically added to a page #75

Open nicksterFL opened 7 years ago

nicksterFL commented 7 years ago

anyway to bind the mentionsInput to a textarea that is dynamically added to the dom?

ivirabyan commented 7 years ago

just call the plugin right after you added textarea to the dom

lukaszpro commented 7 years ago

We do something similar to:

<div id="content_1">
This is example content.
<a href="/contents/1/edit.js" data-remote="true">Edit</a>
</div>
//contents/1/edit.js

$('#content_1').replaceWith('<div id="content_1_edit"><textarea class="mention"></textarea></div>');
$('.mention').mentionsInput({ source: '/users.json' });

Let's think about it like inline editing.

It does not work. I am not able to use @mention in the newest textarea.