229 characters using plain JavaScript and proper forms and buttons, for somewhat better accessibility: document.write(" ${x.value.replace(/&/,`&`).replace(/ `),x.value=``,!1'> ") This even leaves enough space in the tweet for if you wanted a button beside the initial text box. As you see, it’d be shorter as straight HTML without the “body must be empty, you can only write inside a tag” requirement, as you could j…
Note that HN apparently ate your "delete" character(s) (happened to me with "recycle" sign as well).
Props for HTML escaping, was not in task, as well as separate delete buttons. Note though that entities in the document.write are transformed, so the "html escaping" is broken in effect; either double escaping or codepoints should make it work.
`${x.value.replace(/\u0026/g,`\u0026amp;`).replace(/
Or, you know, the mighty glorious ancient deprecated "example" element, that is still very well supported. Provided you are OK with danger of ''and will not prevent it, result would be quite terse: `${x.value}`.