How to remove the attribute from an HTML element in jQuery

  1470 views   2 years ago jQuery

Use the jQuery removeAttr() methods

You can use the jQuery removeAttr() method to remove the attributes from an HTML element.

In the following example when you click the "Remove Link" button it will remove the href attribute from the link. Let's try it out and see how this method works:

<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<title>jQuery Removing Attribute from HTML Element</title>
<script src=""></script>
    $(document).ready(function() {
    <button type="button" class="remove-attr">Remove Link</button>
    <a href="#">Demo Link</a>


Author : Harsukh Makwana
Harsukh Makwana

Hi, My name is Harsukh Makwana. i have been work with many programming language like php, python, javascript, node, react, anguler, etc.. since last 5 year. if you have any issue or want me hire then contact me on [email protected]