cursor out of control in textarea on IOS8 safari

╄→гoц情女王★ 提交于 2019-12-11 10:27:28

问题


cursor is not in textarea when user input long text or input some enter. This only happens on IOS8. see attachment.


回答1:


find a wordaround to resolve the problem.

textarea.addEventListener('scroll', function(evt){
    evt = evt || window.evt;
    evt.target.setSelectionRange(evt.target.textLength - 1, evt.target.textLength - 1);
    setTimeout(function(){
        evt.target.setSelectionRange(evt.target.textLength, evt.target.textLength);
    }, 0);
});


来源:https://stackoverflow.com/questions/31376906/cursor-out-of-control-in-textarea-on-ios8-safari

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!