Skip to content
geeksforgeeks
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Tutorials
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
  • Practice
    • Build your AI Agent
    • GfG 160
    • Problem of the Day
    • Practice Coding Problems
    • GfG SDE Sheet
  • Contests
    • Accenture Hackathon (Ending Soon!)
    • GfG Weekly [Rated Contest]
    • Job-A-Thon Hiring Challenge
    • All Contests and Events
  • jQuery Tutorial
  • jQuery Selectors
  • jQuery Events
  • jQuery Effects
  • jQuery Traversing
  • jQuery HTML & CSS
  • jQuery AJAX
  • jQuery Properties
  • jQuery Examples
  • jQuery Interview Questions
  • jQuery Plugins
  • jQuery Cheat Sheet
  • jQuery UI
  • jQuery Mobile
  • jQWidgets
  • Easy UI
  • Web Technology
Open In App
Next Article:
How to create a Disabled Input using jQuery Mobile ?
Next article icon

How to remove clickable behavior from a disabled link using jQuery ?

Last Updated : 31 May, 2023
Comments
Improve
Suggest changes
Like Article
Like
Report

In this article, we will see how to remove the clickable behavior from a disabled link using jQuery. To remove the clickable behavior, we will use the removeAttr() method. The removeAttr() method is used to remove one or more attributes from the selected elements.

Syntax:

$(selector).removeAttr(attribute)

Parameters: This method accepts a single parameter attribute that is mandatory. It is used to specify one or more attributes to remove. Several attributes can be separated using the space operator.

In this article, we will remove the href attribute using the removeAttr() method.

Example: In this example, we will see the use of the removeAttr() method.

HTML
<!DOCTYpe html> <html> <head>     <title>         How to remove clickable behavior from         a disabled link using jQuery?     </title>     <script src= "https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">     </script>     <script>         $(document).ready(function () {             $("body").css("text-align", "center");             $("h1").css("color", "green");             $("a").css({                 fontSize: "34px",                 fontWeight: "bold",                 color: "green",                 textDecoration: "none"             })             $("a").each(function () {                 if ($(this).hasClass("disabled")) {                     $(this).removeAttr("href");                 }             });         });     </script> </head>  <body>     <a href="https://www.geeksforgeeks.org/"         class="disabled">         GeeksforGeeks     </a>     <h3>         How to remove the clickable behavior from         <br>a disabled link using jQuery?     </h3> </body> </html> 

Output:


Next Article
How to create a Disabled Input using jQuery Mobile ?

V

vkash8574
Improve
Article Tags :
  • Web Technologies
  • JQuery
  • HTML-Tags
  • CSS-Properties
  • jQuery-Methods
  • HTML-Questions
  • CSS-Questions
  • jQuery-Questions

Similar Reads

  • How to make a Disabled Checkbox using jQuery Mobile ?
    jQuery Mobile is a web based technology used to make responsive content that can be accessed on all smartphones, tablets and desktops. In this article, we will be creating a Disabled Checkbox using jQuery Mobile. Approach: Add jQuery Mobile scripts needed for your project. <link rel=”stylesheet”
    1 min read
  • How to Remove an Event Handler using jQuery ?
    In jQuery, event handlers allow developers to execute code when users interact with elements, such as clicking a button or hovering over a link. However, there are situations where you may need to remove these handlers to prevent further actions or optimize performance, which can be done using speci
    2 min read
  • How to disable right-click option using the jQuery ?
    The bind() method in jQuery is used to attach one or more event handlers for selected element and this method specifies a function to run when an event occurs. Syntax: $(selector).bind(event, data, function);Parameters: This method accepts three parameters as mentioned above and described below: eve
    2 min read
  • How to make a Disable Buttons using jQuery Mobile ?
    jQuery Mobile is a web based technology used to make responsive content that can be accessed on all smartphones, tablets and desktops. In this article, we will be making a Disable Button using jQuery Mobile. Approach: First, add jQuery Mobile scripts needed for your project. <link rel="stylesheet
    1 min read
  • How to create a Disabled Input using jQuery Mobile ?
    jQuery Mobile is a web based technology used to make responsive content that can be accessed on all smartphones, tablets and desktops. In this article, we will be creating a Disabled Input using jQuery Mobile. Approach: Add jQuery Mobile scripts needed for your project. <link rel=”stylesheet” hre
    1 min read
  • How to create a Disabled Option Select using jQuery Mobile ?
    jQuery Mobile is a web-based technology used to make responsive content that can be accessed on all smartphones, tablets, and desktops. In this article, we will be creating a Disabled Option Select using jQuery Mobile. Approach: First, add jQuery Mobile scripts needed for your project. <link rel=
    1 min read
  • How to create a Disabled Slider using jQuery Mobile ?
    jQuery Mobile is a web based technology used to make responsive content that can be accessed on all smartphones, tablets and desktops. In this article, we will be creating a Disabled Slider using jQuery Mobile. Approach: Add jQuery Mobile scripts needed for your project. <link rel=”stylesheet” hr
    1 min read
  • How to enable/disable a button using jQuery ?
    Enabling/disabling a button using jQuery involves altering its functionality to either accept user input or not. This is typically done by manipulating its 'disabled' property or attribute through jQuery methods like `.prop()` or .attr(). To enable/disable a button using jQuery, you'll need a basic
    2 min read
  • How to remove “disabled” attribute from HTML input element using JavaScript ?
    In HTML, we use input elements for user input. The 'disabled' property helps prevent interaction with these elements. For example, if we only want users over 18 to input their Adhar card numbers, we can use JavaScript to remove the 'disabled' attribute when the user enters an age greater than 18. Th
    2 min read
  • How to hide/show an image on button click using jQuery ?
    In this article, we will see how we can hide or show any particular image in jQuery when a button gets clicked. This is quite easy to do with some lines of jQuery code. Before we jump to the topic, let's know which methods of jQuery will be used for this. So there is a method called show() and anoth
    3 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences