mindroute / bootstrap-quill

Quill Rich Text Editor for Bootstrap 4
MIT License
8 stars 7 forks source link

How to install multiple quill on the same page? #2

Closed nobutsta closed 5 years ago

nobutsta commented 5 years ago

I have 3 input-textareas on the same page. And want to install quill on all. I changed from ID into ClassName hoping it will activate all the inputs - but unlucky. How to do so?

klasjersevi commented 5 years ago

You will need one Quill instance for each place you want quill, as the quill constructor only uses the first matched element in a selector. So you can use querySeletorAll or jQuery, then loop over the collection of elements to create instances for each container.

Read more at https://quilljs.com/docs/configuration/

var options = { /* editor options */ };

document.querySelectorAll('.editor').forEach(function(container) {
    new Quill(container, options);
});