开发者

Handle when text in a text box changes

I need to change text in a text box with jQuery, before onBlur and without using key events.

For example, if the text in the box was changed without the user typing any input, I could handle that event.

I've tried using $('input.myInput').change(), but the event only fires after开发者_运维问答 the user tabs off of that text box.

Any help is appreciated.

Many thanks!


Simply put, there isn't and event for value/attribute change (called a Mutation Event) built into jQuery.

There are some plugins out there; however, YMMV with them. I hope you find something that works for you!

Good luck.


I ran into this a while back, the best method i came up with is to bind other events that would change the value.

   $('input.myInput').bind('paste cut keyup mouseup change', function () {
           //Do Stuff
      });
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜