jQuery Example | Remove a DOM Element Attribute

In jQuery, in order to remove a dom element attribute, we can use removeAttr() function. We will use an example to introduce how to do.

For example:

<script>
$(document).ready(function(){
    // Removes the hyperlink's href attribute
    $("button").click(function(){
       $("a").removeAttr("href");
    });
});
</script>

In this example, we will remove the href attribute form all <a> elements.