KutePHP
KutePHP

Reputation: 2236

how to set id to an element inside tiny mce

I want to add an Id to the element which is being edited using a tine mce instance ? Is there any way ?

Upvotes: 1

Views: 2489

Answers (1)

Thariama
Thariama

Reputation: 50840

Yes, there is a way. You need to get the selections parent node and apply the attribute id there:

ed.onDesiredEvent.add(function(editor, event) {
    node = editor.selection.getNode();
    node.setAttribute('id','the_id_to_be_assigned');
}

Upvotes: 2

Related Questions