Selecting text in mobile Safari on iPhone

前端 未结 4 609
闹比i
闹比i 2020-12-13 02:41

I\'m trying to make it easy for an iphone user to copy some text to the clipboard in mobile safari. As in the usual \"touch-hold-copy\". There is a specific bit of text I wa

4条回答
  •  离开以前
    2020-12-13 03:30

    I have run into the same problem. The onfocus event is the right one to trap (ontouchstart isn't triggered if you use the iphone keyboard [next]/[prev] buttons.) If you put an alert(); in your onfocus="" handler, you'll see the alert box pop up. The problem is this.select(); I still haven't found an answer to this, but when/if I do, I'll post it here.

提交回复
热议问题