如果另一个textarea被禁用,IE11 textarea会失去焦点 [英] IE11 textarea loses focus if another textarea is disabled

查看:135
本文介绍了如果另一个textarea被禁用,IE11 textarea会失去焦点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

中,使用ie11与开放的控制台,输入任何 textarea ,然后点击其他任何 textarea 。在控制台中,您会看到第一个 textarea 的触发事件 change ,然后这个 textarea 获取禁用,但是 focus 第二个 textarea事件没有被触发。为什么?

在我的例子中,我能够通过使用 readonly 来取得 disabled ,但通常这看起来很奇怪。一个错误?

对于 input type = text 它按预期工作,现在我能够重现它 textarea only。

解决方案

您需要将 .focus()禁用 textarea



请检查这个我有更新您的 小提琴

In this fiddle, using ie11 with open Console, input something into any textarea and then click into any other textarea. In console, you will see that change event for the first textarea is triggered, then this textarea gets disabled, but focus event for the second textarea is not triggered. Why?

In my case, I was able to achieve what I needed by using readonly instead of disabled, but generally this looks quite odd. A bug?

For input type=text it works as expected, for now I was able to reproduce it for textarea only.

解决方案

you need to put .focus() after disable textarea.

Please Check this I have update your fiddle

这篇关于如果另一个textarea被禁用,IE11 textarea会失去焦点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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