ItSolutionStuff.com

How to Disable a Anchor Tag in HTML?

By Hardik Savani September 5, 2020
Javascript HTML jQuery

This tutorial is focused on how to disable anchor tag in html using javascript. you will learn how to disable a tag in html. we will help you to give example of how to disable a element in javascript. This article goes in detailed on how to disable a tag in jquery. follow bellow step for how to disable a anchor tag in jquery.

If you want to disable a tag then i will give you several examples of how to disable anchor tag using css, jquery and javascript.

so, let's see bellow some simple example that will help you how to disable a tag href in html.

Example 1:

<!DOCTYPE html>

<html>

<head>

<title>How to Disable a Anchor Tag in HTML? - ItSolutionStuff.com</title>

<style type="text/css">

a.disabled {

pointer-events: none;

cursor: default;

opacity: .6;

}

</style>

</head>

<body>

<h1>How to Disable a Anchor Tag in HTML? - ItSolutionStuff.com</h1>

<a href="https://www.itsolutionstuff.com" class="disabled">Go to ItSolutionStuff.com</a>

</body>

</html>

Example 2:

<!DOCTYPE html>

<html>

<head>

<title>How to Disable a Anchor Tag in HTML? - ItSolutionStuff.com</title>

</head>

<body>

<h1>How to Disable a Anchor Tag in HTML? - ItSolutionStuff.com</h1>

<a href="https://www.itsolutionstuff.com" onclick="return false;">Go to ItSolutionStuff.com</a>

</body>

</html>

Example 3:

<!DOCTYPE html>

<html>

<head>

<title>How to Disable a Anchor Tag in HTML? - ItSolutionStuff.com</title>

</head>

<body>

<h1>How to Disable a Anchor Tag in HTML? - ItSolutionStuff.com</h1>

<a href="javascript:function() { return false; }">Go to ItSolutionStuff.com</a>

</body>

</html>

Example 4:

<!DOCTYPE html>

<html>

<head>

<title>How to Disable a Anchor Tag in HTML? - ItSolutionStuff.com</title>

<style type="text/css">

a[disabled="disabled"] {

pointer-events: none;

}

</style>

</head>

<body>

<h1>How to Disable a Anchor Tag in HTML? - ItSolutionStuff.com</h1>

<a href="https://www.itsolutionstuff.com" disabled="disabled">Go to ItSolutionStuff.com</a>

</body>

</html>

I hope it can help you...

Hardik Savani

Hardik Savani

I'm a full-stack developer, entrepreneur, and founder of ItSolutionStuff.com. Passionate about PHP, Laravel, JavaScript, and helping developers grow.

📺 Subscribe on YouTube

We Are Recommending You

How to Set HTML Meta Tags in Angular?

Read Now →

JQuery QR Code Scanner using Instascan JS Example

Read Now →

JQuery Validate File Size with Multiple File Upload Example

Read Now →

HTML Tags are not Allowed in Textbox Validation using JQuery

Read Now →

Display Loading Image when AJAX Call is in Progress Example

Read Now →

How to Scrolling Table with Fixed Header in HTML?

Read Now →

How to Set Vertical Align Middle to Div by CSS in HTM?

Read Now →

How to Create Responsive Menu in HTML/PHP ?

Read Now →

How to Convert Line Breaks to br in jQuery ?

Read Now →

How to Check Object is Empty or Not in JQuery?

Read Now →

Autocomplete with Images and Custom HTML Code in Jquery UI?

Read Now →