0

I'm using this code in my index.html file, to prevent using right-click except on editing fields:

<script type="text/javascript">
    $(document).ready(function(data){
       $(document).bind('contextmenu',function(e){
        var t = $(e.target).closest('#editor,.validatebox-text');   // enable right click on HTML editor and all input's
        if (!t.length){
          e.preventDefault();           
        }
      });      
    });
  </script>

question is - how to enable right-click on texteditor, too? Thank you

Wojtek322
  • 584
  • 7
  • 20

2 Answers2

0

I tried with :

var t = $(e.target).closest('#editor,.validatebox-text,textarea');

Disclaimer

Tom
  • 4,972
  • 3
  • 10
  • 28
0

Adding tags to the closest() function should enable right click on them.

var t = $(e.target).closest('input, textarea');
Mithu Mondal
  • 265
  • 2
  • 11