Disable Links with jQuery

jQuery's built in preventDefault() method is a great way to prevent the default functionality of an element from occurring. It's probably most commonly used to disable links. Maybe you want a certain link only to work under certain conditions (like for example, you only want it clicked if the user is on a desktop sized screen), or maybe you want to disable a link all together. Either way, doing so is pretty simple with jQuery's preventDefault() method.

$("a").click(function(event){
    event.preventDefault();
});

The code snippet above will disable ALL your links, so make sure that in place of "a", you write the exact class or ID of the link you'd like to select and disable, otherwise none of your links will work!