What I've tried
I checked out this question, and this one, the problem is it gives me the content of the current selection, but I want the dom element instead.
What I want to do
I'm looking for a way to get the tagname of an element that is currently being edited with javascript. For example:
<article contenteditable=true>
<h2>Some List</h2>
<ul>
<li>Item 1</li>
<li>Item *caret here* 2</li>
<li>Item 3</li>
</ul>
</article>
I want to be able to put the list item into a javascript el
variable. So I that I can do for example:
el.tagName
el.className
Does anyone know how to achieve this? Tx :)