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
Try the following:
$(document).ready(function(){
$(".test").bind("paste keyup change", function() {
console.log($(this).val().length);
});
});