[英]TinyMCE Editor - how to access custom attributes through jQuery
I used to have a textarea with classname '.dyskografia' and I was accessing that class in order to paste some content into it. 我曾经有一个类名为“ .dyskografia”的文本区域,并且正在访问该类以便将一些内容粘贴到其中。
It used to be like this: 以前是这样的:
$(this.el).find('.dyskografia').html("blah blah blah");
When I incorporated TinyMCE Editor, it messed up with my tags and now I suppose this is what I should be reffering to - data-id="Dyskografia": 当我合并TinyMCE Editor时,它弄乱了我的标签,现在我想这就是我应该参考的-data-id =“ Dyskografia”:
<body id="tinymce" class="mce-content-body " data-id="Dyskografia" contenteditable="true" spellcheck="false"><p>...</p></body>
How can I change my previous code to be pasting "blah blah blah" into the tag with data-id="Dyskografia"? 如何更改以前的代码,以将“ blah blah blah”粘贴到带有data-id =“ Dyskografia”的标签中?
You can set the content of your TinyMCE editor with this: 您可以使用以下方法设置TinyMCE编辑器的内容:
// Sets the HTML contents of the activeEditor editor
tinyMCE.activeEditor.setContent('<span>some</span> html');
// Sets the raw contents of the activeEditor editor
tinyMCE.activeEditor.setContent('<span>some</span> html', {format : 'raw'});
// Sets the content of a specific editor (my_editor in this example)
tinyMCE.get('my_editor').setContent(data);
// Sets the bbcode contents of the activeEditor editor if the bbcode plugin was added
tinyMCE.activeEditor.setContent('[b]some[/b] html', {format : 'bbcode'});
If you are interesting in more information you can read the documentation 如果您对更多信息感兴趣,可以阅读文档
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.