HTML DOMTokenList value Property
Last Updated :
12 Jul, 2022
The TokenList value property in HTML DOM is used to return a string value that specifies the value of the particular tokens or nodes from the DOM TokenList.
Syntax:
domtokenlist.value
Parameter Values: This method does not contain any parameter values.
Example: Below HTML code demonstrates how to return the value of the particular class of an <div> element.
HTML
<!DOCTYPE html>
< html >
< head >
< style >
.myGeeks {
color: green;
}
.Hello_Geeks {
text-align: center;
font-size: 15px;
}
</ style >
</ head >
< body style = "text-align:center" >
< h1 class = "myGeeks" >GeeksforGeeks</ h1 >
< h2 >HTML DOM TokenList value Property</ h2 >
< div id = "divID" class = "Hello_Geeks" >
< p >GFG Stands for GeeksforGeeks.
A good platform for learning computer science
</ p >
</ div >
< button onclick = "class_value()" > Return</ button >
< p id = "demo" style = "font-size:25px" ></ p >
< script >
function class_value() {
var x = document.getElementById("divID").classList;
var w = x.value;
document.getElementById("demo").innerHTML = w;
}
</ script >
</ body >
</ html >
|
Output:
Supported Browsers: The browser supported by the DOM TokenList value property is listed below.
- Google Chrome 50 and above
- Edge 17 and above
- Internet Explorer not supported
- Firefox 47 and above
- Opera 37 and above
- Safari 10 and above
Like Article
Suggest improvement
Share your thoughts in the comments
Please Login to comment...