使用jQuery的fire oninput事件 [英] Fire oninput event with jQuery

查看:139
本文介绍了使用jQuery的fire oninput事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在文本区域有一个输入事件来检查高度并调整其大小。现在我需要编辑这个值。我只是通过在jQuery中编辑val()来实现,但这不会触发oninput事件。有没有办法用jQuery编程地触发oninput事件?

I have an oninput event on a textarea to check the height and resize it. Now I need to edit the value sometimes. I do this just by editting the val() in jQuery, but that does not trigger the oninput event. Is there any way to trigger the oninput event programatically with jQuery?

推荐答案

oninput实际上并不在JQuery中。

oninput is not actually in JQuery yet.

您可以在这里查看有关的信息:

You can see posts about it here:

http://forum.jquery.com/topic/html5-oninput-event

http://bugs.jquery.com/ticket/9121

基本上普遍的共识是他们不想要它。

Basically the general consensus is that they don't want it yet.

但不,直接更改val()不会触发html5 oninput因为它的规范说明是用户在UI中更改输入的值。

But no, changing val() directly would not trigger the html5 oninput because it's specification states it is when the user, in the UI, changes the value of the input.

编辑:

但是,有些人已经为希望仅使用HTML5事件的人员提供了一个插件: https: //github.com/ dodo / jquery-inputevent

However some one has kindly made a plugin for people who wish to use HTML5 only events: https://github.com/dodo/jquery-inputevent

这篇关于使用jQuery的fire oninput事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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