Remove id attribute from an element using jquery

Last updated 4 years, 2 months ago | 3406 views 75     5

Jquery | Remove id attribute from an element

The removeAttr() function from jquery is used to removes one or more attributes from the selected elements.



Here seen an example with complete code

In this example, the id of div gets remove at the time of page load.

<!DOCTYPE html>
<html lang="en">

    <title>Jquery | Remove id attribue from an element</title>
    <!-- jQuery library -->
    <script src=""></script>

    <!-- Script to remove the Id attribue from div -->
    $(document).ready(function() {

    <div id="first">
        <h1>This div ID removed after page load </h1>