SVG Document.documentElement Property
Last Updated :
30 Mar, 2022
The SVG Document.documentElement property returns the root element of the document.
Syntax:
const element = document.documentElement
Return value: This property returns the root element of the document.
Example 1:
HTML
<!DOCTYPE html>
< html >
< body >
< svg width = "350" height = "500"
< circle cx = "100" cy = "100" r = "50" ></ circle >
< script >
console.log(document.documentElement)
</ script >
</ svg >
</ body >
</ html >
|
Output:
Example 2:
HTML
<!DOCTYPE html>
< html >
< body >
< svg width = "350" height = "500"
< text x = "20" y = "20" >GeeksforGeeks</ text >
< script >
console.log(document.documentElement)
</ script >
</ svg >
</ body >
</ html >
|
Output:
Share your thoughts in the comments
Please Login to comment...