什么时候textarea的更改事件不会被触发? [英] When do textarea change events not get triggered?

查看:294
本文介绍了什么时候textarea的更改事件不会被触发?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我靠更改事件被触发时的文本域的内容发生变化。按照 jQuery的文档,这并不被触发,直到文本区域失去焦点。在什么情况下可以在事件不会被触发?将clsoing一个页面,回去,点击链接等,始终使文本区域失去焦点而被解雇?

I'm relying on the change event being triggered whenever the contents of the textarea changes. According to the jquery docs, this doesn't get triggered until the textarea loses focus. Under what circumstances could the event not be triggered? Would clsoing a page, going back, clicking on a link, etc, always cause the textarea to lose focus and be fired?

或者换一种说法,是有可能留下一个页面没有textarea的论点集中输入丢失?

Or to put it another way, is it possible to leave a page without a focusses textarea losing input?

推荐答案

通过测试型动物,不会触发更改事件时:

With differents tests, the change event is not triggered when:


  • 用户单击浏览器中的任何按钮(后退按钮,刷新,主页按钮...)的(浏览器,火狐AMD歌剧院Linux,但触发时点击ADRESS栏上)

  • 用户使用快捷键(F5,Ctrl + U键...)的(在Chrome +火狐+歌剧测试)

  • the user clicks on any button of the browser (back button, refresh, home button...) (Chrome, Firefox amd Opera on Linux but triggered when click on adress bar)
  • the user uses shortcuts (f5, ctrl+u...) (tested on Chrome + Firefox + Opera).

您可以在这里测试的例子: http://jsfiddle.net/Atinux/S6TkP/

You can test an example here: http://jsfiddle.net/Atinux/S6TkP/

所以,我建议您除了使用KEYUP和KEYDOWN您的输入和textarea的形式活动。

So I recommand you to use in addition keyUp and keyDown events on your input and textarea forms.

这篇关于什么时候textarea的更改事件不会被触发?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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