开发者

Copy/Paste events for javascript on iOS

开发者 https://www.devze.com 2023-02-02 11:25 出处:网络
It appears that oncopy and onpaste do not work with iOS devices that support copy a开发者_JAVA技巧nd paste now.Is there another means to bind to these events in javascript?You didn\'t attached any cod

It appears that oncopy and onpaste do not work with iOS devices that support copy a开发者_JAVA技巧nd paste now. Is there another means to bind to these events in javascript?


You didn't attached any code with your question, so I can't tell what was the actual issue.

Probably the issue is with your code.

I used the following html code and it is working perfectly. Please check with this:

<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

精彩评论

暂无评论...
验证码 换一张
取 消