Tuesday, 11 August 2015

How to disable a click event on an element in jQuery/CSS

There are number of ways to bind the click event to an element. We can use off() or unbind() method provided by jQuery remove the click event. We can also do it using CSS

Add the following class to the CSS file. The particular property of the element can be added with this class for certain business conditions.

CSS:

.inactiveLink {
pointer-events: none;
cursor: default;
}

jQuery:

$("a[id=submit]").addClass('inactiveLink');

No comments:

Post a Comment