wysiwyg.js 仅对第一个 <textarea> 启用编辑器

wysiwyg.js editor enabled only for first <textarea>

我正在尝试将 http://wysiwygjs.github.io/ 编辑器添加到我的 CMS。

似乎该演示通过以下方式启用了编辑器:

    <script type="text/javascript">
$(document).ready(function() {
    // Featured editor
    $('#editor1,#editor2,#editor3').each( function(index, element)
    {

所以我删除了#editor2 和#editor3 以保留我需要的 editor1。

然后通过以下方式在我的脚本中启用它:

<textarea name="tresc[%id]" id="editor1">

而且它只对第一个文本区域有效,其余的没有工具栏。

如果您检查引用的页面,您会看到工具栏包含在文本区域字段上方的单独 div <div class="wysiwyg-toolbar wysiwyg-toolbar-top">...</div> 中。确保您正确安装了所见即所得的 js 文件,并且您应该能够实现它。

另请注意,如果您尝试为多个文本区域实施,请不要重复使用相同的 ID,请使用 class 或递增 ID。