VOOZH about

URL: https://www.geeksforgeeks.org/html/html-dom-tokenlist-replace-method/

⇱ HTML DOM TokenList.replace() Method - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

HTML DOM TokenList.replace() Method

Last Updated : 12 Jul, 2022

The replace() method in HTML DOM is used to replace or change an old token with a new one in a DOM TokenList Object. 

Syntax:

domtokenlist.replace(old, new)

Parameter Values:  It contains two values:

  • old: It is a required parameter, that specifies the name of the token that would be replaced. 
  • new: It is a required parameter, that specifies the name of the new token that replaces with. 

Example: Below HTML code demonstrate the use of replace() method in HTML DOM. 

Output:

👁 Image
 

Supported Browsers: 

  • Google Chrome 61 and above
  • Mozilla Firefox 49 and above
  • Edge 17 and above
  • Safari 10.1 and above
  • Opera 48 and above
  • Internet Explorer not supported
Comment
Article Tags: