如何使用jQuery禁用右键单击?
要禁用页面上的右键单击,请使用jQuerybind()
方法。
示例
您可以尝试运行以下代码以了解如何禁用右键单击:
<!DOCTYPE html> <html> <head> <script src="https://cdn.staticfile.org/jquery/3.2.1/jquery.min.js"></script> <script> $(document).ready(function(){ $(document).bind("contextmenu",function(e){ return false; }); }); </script> </head> <body> <p>Right click is disabled on this page.</p> </body> </html>