ivirabyan / jquery-mentions

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

Not working for object render by ajax (element render after ready) #66

Closed dinhtuvu closed 7 years ago

dinhtuvu commented 7 years ago

this is example: https://jsfiddle.net/dinhtuvu/4jd4hrdu/

after click "Click here to add to test for later render" to add new DIV. mention not working with new div

ivirabyan commented 7 years ago

You have to manualy initialize the plugin for just created element. Continuing your example:

$('body').delegate('.button-add','click', function(){
    var $editable = $('<div class="mentions" contenteditable style="width: 300px; height: 100px;    border: 1px solid #000">please typing!</div>');
    $editable.appendTo($('body'));
    $editable.mentionsInput(...)
});