Paste into input fields not possible anymore
Hi there,
I use your CopyClipboardJS happily because it makes it so easy to add click-and-copy functionality. I recently found that it causes normal fields in forms to become unable to receive a paste from the clipboard. Do you have any idea why and how to fix this?
Regards
Hi Henri, Thank you for your message. Can you please send more details about the problem? We need more details and an example of the problem, for checking it.
Best
Wow what a fast response :-)
I use ClipBoardJS in addition to htmx like this:
<html>
<head>
<script src="/static/js/CopyClipboard.js"></script>
</head>
<body>
<input type="search"
hx-boost="true"
hx-post="/search/"
hx-target="#content"
hx-swap="innerHTML scroll:top"
hx-trigger="keyup changed, keydown[key=='Enter'], search">
<span data-copy-text="dummy-text" onclick="copy.text(this);">dummy-text</span>
</body>
</html>
This works nicely - one click onto the dummy-text and it gets copied.
But, the input field does not accept any paste via ctrl+v or by context menu. Might the htmx stuff be the one to blame?
Thanks for any hint!
So you want to keep the paste feature for the input tag while we have a copy to clipboard feature for the button(here is the span tag). yes?
Yes, exactly.