Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

TinyMCE (or JCE) - How to get current node name and html content

Tags:

tinymce

I am trying to check at which node the cursor / selection is.

I want to get the

  • node name
  • html inside the node
like image 320
Valentin Despa Avatar asked Sep 11 '12 13:09

Valentin Despa


1 Answers

The node can be accessed using:

tinyMCE.activeEditor.selection.getNode()

And there are 2 properties that will return the wanted values: nodeName and innerHTML

tinyMCE.activeEditor.selection.getNode().nodeName

tinyMCE.activeEditor.selection.getNode().innerHTML
like image 199
Valentin Despa Avatar answered Nov 11 '22 03:11

Valentin Despa