How to add a new element in the context menu of a contenteditable
<div>
?
I'd like to add an option "Show HTML" that would display the raw HTML that is inside the div.
document.getElementById("a").oncontextmenu = function() {
alert("How to add a new element in the Context menu?");
}
<div id="a" contenteditable="true">Hello you, <strong>right-click</strong> here and see the <a href="#">new option</a> <i>"Show HTML"</i></div>
Note: Unlike this question or this one I don't want to override the normal context menu and build a new one, but add a new element to the existing context menu: