Skip to content Skip to sidebar Skip to footer

Get Right-clicked Element Jquery

I want to get my
  • element that when i right-click on it: a customized contextual menu appears, and i want to do my treatment over my initially selected element
  • Solution 1:

    To detect right click you can use,

    jquery code

    <scriptlanguage="javascript"type="text/javascript">
        $(function(){
            $('#rClick').on('contextmenu', function(e) {
                alert($(this).attr('id'));
                returnfalse;
            });
        });
    </script>

    html code

    <ul><liid="rClick">AAAAAA</li><liid="rClick2">BBBBBB</li></ul>

    Post a Comment for "Get Right-clicked Element Jquery"