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.


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

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

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

         function display() {
            document.getElementById("test").innerHTML = "Your cut text worked!";

Published on 14-Mar-2018 07:57:58