将属性添加到tinymce中的锚定标记
我想通过tinymce向锚定标记添加一个属性 我现在的课文是将属性添加到tinymce中的锚定标记,tinymce,Tinymce,我想通过tinymce向锚定标记添加一个属性 我现在的课文是 <p><a id="1212" title="abc" href="../abc" target="_blank">Test</a></p> 你可以用 tinyMCE.dom.setAttrib('Element', 'String', 'String'); 这里, 元素:要设置属性的DOM元素、元素id字符串或元素/id数组 字符串:要设置的属性的名称 字符串:此值的属性上要设置的
<p><a id="1212" title="abc" href="../abc" target="_blank">Test</a></p>
你可以用
tinyMCE.dom.setAttrib('Element', 'String', 'String');
这里,
元素:要设置属性的DOM元素、元素id字符串或元素/id数组
字符串:要设置的属性的名称
字符串:此值的属性上要设置的值为空值0或“”,它将删除该属性
例如:
// Sets an attribute to all paragraphs in the active editor
tinyMCE.activeEditor.dom.setAttrib(tinyMCE.activeEditor.dom.select('p'), 'class', 'myclass');
// Sets an attribute to a specific element in the current page
tinyMCE.dom.setAttrib('mydiv', 'class', 'myclass');
我应该在哪里添加此代码段?在
init
tinymce之后?
tinyMCE.dom.setAttrib('Element', 'String', 'String');
// Sets an attribute to all paragraphs in the active editor
tinyMCE.activeEditor.dom.setAttrib(tinyMCE.activeEditor.dom.select('p'), 'class', 'myclass');
// Sets an attribute to a specific element in the current page
tinyMCE.dom.setAttrib('mydiv', 'class', 'myclass');