Get value after right click in context menu PrimeFaces
<p>I created in my project context menu after right click. Menu model is created in Java. In XHTML I have only:</p>

<pre><code>&lt;p:panelMenu style="width:250px" id="menu"
            model="#{menuBean.menuModel}" stateful="false"&gt;
        &lt;/p:panelMenu&gt;

&lt;p:contextMenu id="context" for="menu"
                model="#{menuBean.contextMenuModel}" style="width:300px"&gt; 
</code></pre>

<p>I want get value or id from item when I click on it right mouse click.
How do this in PrimeFaces? I found answer only for using data table. I used in project JSF and PrimeFaces.</p>

<p>EDIT:
I wrote simple jQuery like this:</p>

<pre><code>$(".ui-menuitem-link").contextmenu(function() {
   document.getElementById("hiddenField").value = $(this).text();
});
</code></pre>

<p>It returns the name of selected item, but maybe someone have better solution without jQuery.</p>