cursor out of control in textarea on IOS8 safari

2019-08-12 13:31发布

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

1条回答
该账号已被封号
2楼-- · 2019-08-12 13:45

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);
});
查看更多
登录 后发表回答