I am working on a text editor but want to do an action when someone starts to type inside a paragraph tag that contains an image or has a certain class.
sel = window.getSelection();
var p = sel.baseNode.parentNode;
<p>this is a paragraph</p>
Sorry I deleted my last Answer, because I misunderstood your problem. This is the solution:
You are looking for the
And to check the class: