Skip to content

Instantly share code, notes, and snippets.

@mir4ef
Last active June 30, 2016 11:45
Show Gist options
  • Save mir4ef/c86812b6bec1be0d274199f4c052cb28 to your computer and use it in GitHub Desktop.
Save mir4ef/c86812b6bec1be0d274199f4c052cb28 to your computer and use it in GitHub Desktop.
Disable anchor tag with either css or javascript
<!-- using CSS -->
<head>
<style>
.my-disabled-link {
cursor: default;
pointer-events: none;
}
</style>
</head>
<body>
<a href='my-url.com' class='my-disabled-link'>my disabled link</a>
</body>
<!-- using JavaScript -->
<body>
<a href='my-url.com' onclick='return false;'>my disabled link</a>
</body>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment