Sponsored Links

Showing posts with label jquery. Show all posts
Showing posts with label jquery. Show all posts

April 1, 2019

How to disable right click on web page using jQuery

There are certain ways to disable right click on web page. One of most common ways is using following jQuery code in the web page. Add following code at the end of body inside script tag. Note that it uses jQuery. So import jQuery first.

$(document).bind("contextmenu", function(e) {
     e.preventDefault();
});

December 5, 2017

Cool jQuery Tricks

Some of cool jQuery functions usage:
1. To add bounce animation to any element:
 $(elem).addClass("animate bounce");

2. To add shake animation to any element:
 $(elem).addClass("animate shake");

3. To disable buttons or any control elements:
$(elem).prop("disabled", true);
You can also use attr() function, but attr() is deprecated. So use prop().