在IOS8 safari上,textarea中的光标失控 [英] cursor out of control in textarea on IOS8 safari

查看:364
本文介绍了在IOS8 safari上,textarea中的光标失控的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

光标不在textarea中。这只发生在IOS8上。见附件。

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

推荐答案

找到一个解决方法来解决问题。

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);
});

这篇关于在IOS8 safari上,textarea中的光标失控的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆