The SVG Event.returnValue property returns a string containing the event’s type.
Syntax:
let eventType = event.type5
Return value: This property returns a string containing the event’s type.
Example 1: In this example, we will use onclick event for SVG circle element.
HTML
<!DOCTYPE html> < html >
< body >
< svg viewBox = "0 0 1000 1000" < circle cx = "50" cy = "50" r = "50" onclick = "check(event)" />
< script type = "text/javascript" >
function check(event) {
document.write(
"This Event is type : ",
event.type);
}
</ script >
</ svg >
</ body >
</ html >
|
Output:
Example 2: In this example, we will use onclick event for SVG text element.
HTML
<!DOCTYPE html> < html >
< body >
< svg viewBox = "0 0 1000 1000" < text x = "50" y = "20" font-size = "20px" onclick = "check(event)" >
GeeksForGeeks
</ text >
< script type = "text/javascript" >
function check(event) {
document.write(
"This Event type is : ",
event.type);
}
</ script >
</ svg >
</ body >
</ html >
|
Output:
Example 3: In this example, we will use onmouseover event for SVG circle element.
HTML
<!DOCTYPE html> < html >
< body >
< svg viewBox = "0 0 1000 1000" < circle cx = "50" cy = "50" r = "50" onmouseover = "check(event)" />
< script type = "text/javascript" >
function check(event) {
document.write(
"This Event type is : ",
event.type);
}
</ script >
</ svg >
</ body >
</ html >
|
Output:
Example 4: In this example, we will use onmouseover event for SVG text element.
HTML
<!DOCTYPE html> < html >
< body >
< svg viewBox = "0 0 1000 1000" < text x = "50" y = "20" font-size = "20px" onmouseover = "check(event)" >
GeeksForGeeks
</ text >
< script type = "text/javascript" >
function check(event) {
document.write(
"This Event type is : ",
event.type);
}
</ script >
</ svg >
</ body >
</ html >
|
Output: