Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

MainLess's avatar

edited

edited

0 likes
16 replies
Sinnbeck's avatar

I assume this works if they type manually? If so I assume you have some Javascript to handle that?

MainLess's avatar

@Sinnbeck Yes, that works when they typing normally on textarea my button is gonna being active, but when right click and pasted text not working.

Sinnbeck's avatar

@MainLess you can try adding another event listener

document.addEventListener('paste', function(params) {
2 likes
MainLess's avatar

@Sinnbeck tried this, but still nothing change. When you paste with keyboard (CTRL+V) it's also work fine. But the problem is about the right clicking event.

Sinnbeck's avatar

You could also consider binding the event to change, so the button is active when you leave the field

MainLess's avatar

@Sinnbeck Your demo work's like a charm, I tried a lot of thing including your demo code, even alert not working :D, and building mix files again but idk what is the problem. But thanks for the effort.

Sinnbeck's avatar
Sinnbeck
Best Answer
Level 102

@MainLess did you try binding it directly to the field?

document.getElementById('NewEntryText').addEventListener('paste', function() {
    alert('works')
});
1 like
MainLess's avatar

@Sinnbeck Yes, I tried just like your code and build it, still button is disabled.

Sinnbeck's avatar

@MainLess are there any errors in the browser console? The smallest syntax error can break everything

Sinnbeck's avatar

@MainLess if they are in red, they might break js which means they new code is never being run

Please or to participate in this conversation.