Add class on anchor
-
I would like to add automatically a class to an anchor.
Basically when you want to add an anchor the code is :
<a id="XXX"></a>
But I would like to see :
<a id="XXX" class="YYYYYYY"></a>
So I have seen this file : tinymce-advanced/mce/anchor/plugin.js
And I have tried to change this code :if (isAnchor) { selectedNode.removeAttribute('name'); selectedNode.id = id; } else { editor.selection.collapse(true); editor.execCommand('mceInsertContent', false, editor.dom.createHTML('a', { id: id, })); }
IN :
if (isAnchor) { selectedNode.removeAttribute('name'); selectedNode.id = id; selectedNode.setAttribute('class','ancre'); } else { editor.selection.collapse(true); editor.execCommand('mceInsertContent', false, editor.dom.createHTML('a', { id: id, })); }
But in vain
I have tried with only
selectedNode.createAttribute('class');
orselectedNode.className = 'test';
But no…
I need help please !!
Thank you so much.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Add class on anchor’ is closed to new replies.