remove the attribute from an HTML element in jQuery

remove the attribute from an HTML element in jQuery

In this post we will give you information about remove the attribute from an HTML element in jQuery. Hear we will give you detail about remove the attribute from an HTML element in jQueryAnd how to use it also give you demo for it if it is necessary.

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">
<head>
<meta charset="utf-8">
<title>jQuery Removing Attribute from HTML Element</title>
<script src="https://.jquery.com/jquery-1.12.4.min.js"></script>
<script>
    $(document).ready(function() {
        $(".remove-attr").click(function(){            
            $("a").removeAttr("href");
        });
    });
</script> 
</head>
<body>
    <button type="button" >Remove Link</button>
    <a href="#">Demo Link</a>
</body>
</html>


 

Hope this and post will helped you for implement remove the attribute from an HTML element in jQuery. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and Keep reading our blogs

For More Info See :: laravel And github

Leave a Comment

Your email address will not be published. Required fields are marked *

4  +  2  =  

We're accepting well-written guest posts and this is a great opportunity to collaborate : Contact US