How to get id like “invokedOn” text by a right click event with Bootstrap ContextMenu?

I am using Bootstrap 3.0 ContextMenu. here is a link http://jsfiddle.net/KyleMit/X9tgY/

I need to know how i can get the id or data-Id of the clicked element. i try many of the tricks but i cant get the clicked element id? Like when i clicked on “Jacob” row i get the “Jacob” after clicked. I also need from this line
<td data-id="user-3">
<a data-id="user-3">Jacob<a/>
<td/>

“data-Id”?

  • context menu with full calendar, passing data between calendar and context menu
  • jstree 3.0.0 contextmenu right click not working. Showing TypeError: vakata_context.element.html is not a function
  • HTML5 contextmenu - Access originally clicked element when menu item is clicked
  • jQuery Right-Click Context Menu Help!
  • Making custom right-click context menus for my web-app
  • Creating dynamic context menu in Chrome Extension is failing
  • i tried var $selectedFileId = $(this).closest('a').html(); or alert($(this).parent('a').html());

  • CKEditor - Add Context Menu Item to Images
  • jQuery ContextMenu event not working in IOS 8.2
  • Custom context menu in d3 and svg
  • Can we disable right clicking on Anchor Tag in HTML
  • Anchor tag event not firing
  • Enabling jQuery contextMenu item on ajax request
  • 2 Solutions collect form web for “How to get id like “invokedOn” text by a right click event with Bootstrap ContextMenu?”

    Use this code for get clicked element id

    jQuery(document).on('click', function(e){
    console.log(e.target.id);
    })
    

    I get the id by little additions in the contextMenu handler, Changes

    // click handler for context menu
    function ContextMenuClickHandler() {
        $(settings.menuSelector)
         .off('click')
         .on('click', function (e) {
          $(this).hide();
    
           var $invokedOn = $(this).data("invokedOn");
           var $selectedMenu = $(e.target);
           // My Changes
           var $selectedFileId = $(this).data("invokedOn").find('.yourClass').attr('id');
    
           settings.menuSelected.call($(this), $invokedOn, $selectedMenu, $selectedFileId);
        });
    }