Reputation: 4051
Is there anyway I can call a function when the text of a TextBox is being changed?
The function change
will work only after the textbox has lost his focus. I need something similar to the keyup
function:
$('.TextBox1').keyup(function(e) {
setTimeout(function() {
//
}, 100);
});
But, this function will only be called if the data is being filled through keyboard, and i need a more general solution. Some cases are:
Is there any Jquery "ontextchanging" event?
Upvotes: 0
Views: 982
Reputation: 4051
I found the answer:
function monitor() {
// Your code
}
var timer = '';
$('.TextBox1').on('focus', function() {
timer = setInterval(monitor, 100);
}).on('blur', function() {
clearInterval(timer);
});
It basically monitors TextBox1
every 0.1 second while it is focused. This is what I was looking for.
Upvotes: 0
Reputation: 2967
$('input').bind('keyup keypress blur change cut copy paste ', function() {
setTimeout(function() {
alert('here');
}, 100);
});
Drag and Drop Example :http://jsfiddle.net/5DCZw/2/
Upvotes: 3