Copy / Paste events for javascript on iOS

It seems that oncopy and onpaste do not work with iOS devices that support copy and paste. Is there any other way to bind to these events in javascript?

+3
source share
1 answer

You did not provide any code with your question, so I can’t say what the problem is.

The problem is probably related to your code.

I used the following html code and it works fine. Please check it:

<html>
    <head>
        <script type="text/javascript">
            function read()
            {
                var name = document.getElementById('p').value;
                alert('Hi: '+name);
            }

            function copy()
            {
                alert('Copy');
            }

            function paste()
            {
                alert('Paste');
            }
        </script>
    </head>
    <body oncopy='copy();' onpaste='paste();'>
        <form>
            <input type="text" name='m' id='p'/>
            <input type="button" value="Submit" onclick='read();'/>
        </form>
    </body>
</html>
0
source

Source: https://habr.com/ru/post/1783267/


All Articles