Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

SVG Event.cancelable Property

  • Last Updated : 05 Nov, 2020

The SVG Event.cancelable property indicates whether the event can be canceled.

Syntax:

Attention reader! Don’t stop learning now. Get hold of all the important HTML concepts with the Web Design for Beginners | HTML  course.

bool = event.cancelable

Return value: This property returns the boolean value of the event element.

Example 1: In the following example, we will be using onclick event.



HTML




<!DOCTYPE html>
<html>
  
<body>
    <svg viewBox="0 0 1000 1000" 
        xmlns="http://www.w3.org/2000/svg">
          
        <circle cx="50" cy="50" r="50" 
            onclick="check(event)" />
  
        <script type="text/javascript">
            function check(event) {
                document.write(
                    "This Event is cancelable : ",
                    event.cancelable);
            }
        </script>
    </svg>
</body>
  
</html>

Output:

Example 2: In the following example, we are using onclick event.

HTML




<!DOCTYPE html>
<html>
  
<body>
    <svg viewBox="0 0 1000 1000" 
        xmlns="http://www.w3.org/2000/svg">
          
        <text x="50" y="20" font-size="20px" 
            onclick="check(event)">
            GeeksForGeeks
        </text>
  
        <script type="text/javascript">
            function check(event) {
                document.write(
                    "This Event is cancelable : ",
                    event.cancelable);
            }
        </script>
    </svg>
</body>
  
</html>

Output:

Example 3: In the following example, we are using onmouseover event.

HTML




<!DOCTYPE html>
<html>
  
<body>
    <svg viewBox="0 0 1000 1000"
        xmlns="http://www.w3.org/2000/svg">
          
        <circle cx="50" cy="50" r="50" 
            onmouseover="check(event)" />
          
        <script type="text/javascript">
            function check(event) {
                document.write(
                    "This Event is cancelable : ", 
                    event.cancelable);
            }
        </script>
    </svg>
</body>
  
</html>

Output:

Example 4: In this example, we will use onmouseover event.

HTML




<!DOCTYPE html>
<html>
  
<body>
    <svg viewBox="0 0 1000 1000" 
        xmlns="http://www.w3.org/2000/svg">
          
        <text x="50" y="20" font-size="20px"
            onmouseover="check(event)">
            GeeksForGeeks
        </text>
  
        <script type="text/javascript">
            function check(event) {
                document.write(
                    "This Event is cancelable : ",
                    event.cancelable);
            }
        </script>
    </svg>
</body>
  
</html>

Output:




My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!