<script src="https://code.jquery.com/jquery-2.2.0.js"></script>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
<script src="https://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
<script src="https://cdn.jsdelivr.net/clipboard.js/1.5.5/clipboard.min.js"></script>
<!-- HTML code -->
<div id='maindiv_id'>
<h2>about</h2>
<p>
This uses <a href='http://clipboardjs.com/'>clipboard.js</a> by Zeno Rocha, <a href='http://jquery.com'>JQuery 2.2</a>, <a href='http://jqueryui.com/'>JQueryUI</a> 1.11 menus. The real program motivating this is the <a href='https://github.com/bstarynk/melt-monitor-2015'>MELT monitor</a> (GPLv3 licensed) on <tt>github</tt>. In that program, the relevant <span class='momitemref_cl'>words</span> are in fact some kind of identifiers or variables.
</p>
<hr/>
<h2>demo</h2>
<p>Some <span class='momitemref_cl'>words</span> here <span class='momitemref_cl'>are</span> in <span class='momitemref_cl'>red</span> & <span class='momitemref_cl'>italics</span> (in HTML5 <span class='momitemref_cl'>they</span> are <tt>span</tt>-s
of <tt>class='momitemref_cl'</tt>); right-mouse-click on <span class='momitemref_cl'>them</span>, a dynamically generated <span class='momitemref_cl'>menu</span> (a JQueryUI <span class='momitemref_cl'>one</span>) should appear. If you choose <tt>Hilight</tt> in that <span class='momitemref_cl'>menu</span>, every occurence of that
word should be hilighted. If you choose <tt>Copy</tt>, the word should be selected and copied to the clipboard. BTW, a few <span class='momitemref_cl'>words</span> may occur several times in <span class='momitemref_cl'>red</span>, <span class='momitemref_cl'>they</span> would hilight together.</p>
</div>
<hr/>
<p>
See <a href='http://stackoverflow.com/q/35340862/841108'>my question</a> on StackOverflow.
<br/>
<br/> Maybe I should have a different approach.
<br/> Perhaps I should use <tt>contextmenu</tt>-s.
</p>