Tags
jQuery
Asked 1 years ago
24 Apr 2023
Views 295
QuickIos

QuickIos posted

how to disable a hyperlink using jQuery

How can I use jQuery to disable a hyperlink or prevent its default behavior? For instance, if I have an anchor tag with an ID of "my-link" and I want to prevent it from redirecting the user to another page when clicked, how can I achieve this using jQuery?

Additionally, let's say I want to add a CSS class to the disabled link to change its appearance. How can I do this using jQuery?
Post Answer