jQuery removeAttr() remove attributes from html element

Description

jQuery removeAttr() remove attributes from html element

View in separate window

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery Removing Attribute from HTML Element</title>
<script src="https://code.jquery.com/jquery-1.12.4.min.js"></script>
<script>
    $(document).ready(function() {
        $(".remove-attr").click(function(){
            $("a").removeAttr("href");
        });/*from  w  w  w. j a va  2s  . c  om*/
    });
</script>
</head>
<body>
    <button type="button" class="remove-attr">Remove Link</button>
    <a href="#">Demo Link</a>
</body>
</html>



PreviousNext

Related