HDTuto.com

How to Disable Anchor Tag in HMTL using Javascript?



Hello all! In this article, we will talk about how to disable a tag in jquery. if you have question about how to disable a anchor tag in jquery then i will give simple example with solution. we will help you to give example of disable anchor tag in html. let’s discuss about how to disable anchor tag in html using javascript. Follow bellow tutorial step of how to disable a tag in html.

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? - HDTuto.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? - HDTuto.com</h1>

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

</body>

</html>

Example 2:

<!DOCTYPE html>

<html>

<head>

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

</head>

<body>

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

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

</body>

</html>

Example 3:

<!DOCTYPE html>

<html>

<head>

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

</head>

<body>

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

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

</body>

</html>

Example 4:

<!DOCTYPE html>

<html>

<head>

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

<style type="text/css">

a[disabled="disabled"] {

pointer-events: none;

}

</style>

</head>

<body>

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

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

</body>

</html>

I hope it can help you...




July 31, 2020 | Category : Javascript



Blog Search