开发者

Copy/Paste events for javascript on iOS

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜