Execute a script when the content of the element is being cut in HTML?

HTMLWeb DevelopmentFront End Technology

When the user cuts the elements' text, the oncut attribute triggers in HTML.

Example

You can try to run the following code to implement the oncut attribute −

<!DOCTYPE html>
<html>
   <body>
      <input type = "text" oncut = "display()" value = "Cut me">

      <h2 id = "test">Try to cut the above text.</h2>

      <script>
         function display() {
            document.getElementById("test").innerHTML = "Your cut text worked!";
         }
      </script>

   </body>
</html>
raja
Published on 14-Mar-2018 12:27:58
Advertisements