Can I use onpaste event in my plugin?

Here is part of my plugin code, I have a textarea to paste svg code, and I want to modify it before pasting

    let input_field = document.createElement("textarea")
    input_field.setAttribute("id", "svgcode");
    input_field.style.minWidth = 400
    input_field.style.minHeight = 400
    container.appendChild(input_field)
    input_field.onpaste = async (e) => {
        console.log("balabala")
        // lamclipboard = e.clipboardData.getData('Text')
        // modify lamclipboard

    }

The onpaste here is not working.

Why document onclick event can work well in similar function?

Not all web events are supported – paste is one of them.

If you want to change the content, you’ll need to do so with input or change.