当我用鼠标粘贴文本时,为什么我的文本框字数统计代码不起作用?
我在我的应用程序中使用 jQuery。
我在一个函数上组合使用了 Keyup 和 Change 事件。即我有一个文本框,每当我在其中输入时,字数统计就会出现在它的顶部。所以基本上我有字数统计功能,适用于 Keyup
和 Change
事件。
问题是,当我使用鼠标在文本框中粘贴一些文本时,计数不会改变,除非我按某个键或单击其他地方。
这是我的代码:
events :
'keyup #IdOfTextbox' : 'wordCounter'
'change #IdOfTextbox' : 'wordCounter'
wordCounter() : =>
//Code for counting words in Text Box
I am using jQuery for my application.
I have used Keyup and Change events combined on a function. i.e. I have a textbox and whenever I type in it the word counts comes on top of it. So basically I have word count function which works on Keyup
and Change
events.
The problem is when I use mouse to paste some text in text box the count doesn't changes unless I press some key or I click elsewhere.
Here is my code :
events :
'keyup #IdOfTextbox' : 'wordCounter'
'change #IdOfTextbox' : 'wordCounter'
wordCounter() : =>
//Code for counting words in Text Box
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
请尝试以下操作:
Try the following: