推荐关注
Meteor
JSLint - a JavaScript code quality tool
jsFiddle
D3.js
WebStorm
推荐书目
JavaScript 权威指南第 5 版
Closure: The Definitive Guide
mopig

iOS 中的 safari,有什么办法通过 js 选中指定的文本?

  •  
  •   mopig · Apr 27, 2016 via iPhone · 3413 views
    This topic created in 3692 days ago, the information mentioned may be changed or developed.
    window.getSelection 在 iOS 的 Safari 中不生效。
    1 replies    2016-04-28 08:08:02 +08:00
    leisure
        1
    leisure  
       Apr 28, 2016
    iOS 不同版本的情况也不一样,我试了很多次也没有达到一个完美的效果。
    给 id 为 content 的 textarea 的 touchstart 事件绑定了如下方法。。。
    var content = document.getElementById("content");
    content.focus();
    content.selectionStart = 0;
    content.selectionEnd = content.value.length;
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3003 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 30ms · UTC 07:10 · PVG 15:10 · LAX 00:10 · JFK 03:10
    ♥ Do have faith in what you're doing.