jquery-mentions
jquery-mentions copied to clipboard
applying to textarea that is dynamically added to a page
anyway to bind the mentionsInput to a textarea that is dynamically added to the dom?
just call the plugin right after you added textarea to the dom
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.