Fire oninput event with jQuery

前端 未结 7 943
太阳男子
太阳男子 2020-12-02 22:47

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 doe

7条回答
  •  不思量自难忘°
    2020-12-02 23:07

    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.

    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.

    Edit:

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

提交回复
热议问题