Home > Tips & Tricks > Disable right-click with jQuery

Disable right-click with jQuery

Do you want to disable the right-click on the webpage using jQuery? Then you just have to add 4 lines of code to achieve this. We will learn how you can do this with the below code.

The right-click actually prevents the user to view your webpage source and many other things like network request check, style code check, accessibility, etc.

Let’s see the simple 4 line code.

Add the above jquery code in your footer of the webpage (in WordPress you can add in footer.php file) and it will disable the right-click when someone tries to click on the webpage.

Being Tricky 😉

Photo of author

About Aman Mehra

Hey there! I'm Aman Mehra, a full-stack developer with over six years of hands-on experience in the industry. I've dedicated myself to mastering the ins and outs of PHP, WordPress, ReactJS, NodeJS, and AWS, so you can trust me to handle your web development needs with expertise and finesse. In 2021, I decided to share my knowledge and insights with the world by starting this blog. It's been an incredible journey so far, and I've had the opportunity to learn and grow alongside my readers. Whether you're a seasoned developer or just dipping your toes into the world of web development, I'm here to provide valuable content and solutions to help you succeed. So, stick around, explore the blog, and feel free to reach out if you have any questions or suggestions. Together, let's navigate the exciting world of web development!

Leave a Comment