A user requests removal of selected editable content to the clipboard. HTML event-handler content attribute or corresponding event-handler property; the event fires only on relevant targets. The example uses document.getElementById("demo"). Event interface: ClipboardEvent. For the described native event: bubbles: yes; cancelable: yes. Canceling stops the default cut; if replacing it, handle both clipboard data and editing intentionally. Example: Select text and use the ordinary copy, cut or paste command. The event listener is registered with addEventListener(), which avoids inline script handlers and supports multiple listeners. Inline handlers require a CSP that permits them; do not insert untrusted code into handler attributes.

Formal Syntax & Structure

html syntaxhtml
<input oncut="handleEvent(event)">target.addEventListener("cut", event => { /* handle event */ });

Parameters & Attributes

NameTypeDescription
oncutJavaScript handler bodyOptional HTML event-handler code; the example uses a registered listener instead. Not a Boolean attribute.
eventClipboardEventEvent object delivered to the addEventListener callback; event.type is "cut". Inspect target, currentTarget, bubbles and cancelable as appropriate.

Working Example

Example Snippethtml
<label for="demo">Sample text</label><input id="demo" value="Example text"><p role="status" id="log">Waiting for cut</p><script>  const target = document.getElementById("demo");  const log = document.getElementById("log");  target.addEventListener("cut", event => {    log.textContent = String(event.type);  });</script>
HTML Reference