HTML DOM TokenList.remove() Method

Last Updated : 12 Apr, 2022

The TokenList.remove() Method in HTML DOM is used to remove the particular nodes or tokens from a NodeList. It is an in-built method of TokenList Object. 

Syntax:

remove(token);
remove(token, token);
remove(token, token, token);
...

Parameter Values: It contains a string value that represents the name of the token that you want to remove from the Token List. 

Return Value: This method does not return any value. 

Example: Below HTML code illustrates the use of the token list. remove() Method in HTML DOM. 

HTML
<!DOCTYPE html>
<html>
    
<head>
    <style>
        .geek {
            background-color: green;
            font-size: 50px;
        }
    </style>
</head>

<body>
    <center>
        <h2 id="gfg" class="geek">
            GeeksforGeeks
        </h2>
        <h2>
            HTML DOM TokenList remove() Method
        </h2>
        <button onclick="myGeek()"> Submit </button>
    </center>

    <script>
        function myGeek() {
            var elem = document.getElementById("gfg");

            // removing class from div element
            elem.classList.remove("geek");
        }
    </script>
</body>

</html>                    

Output: 

TokenList.remove() Method in HTML DOM
Comment