Detect An Indirect Update To A Field With Jquery
I have a
Solution 1:
You can try using interval or timeout like this
var searchValue = $('#myTextbox').val();
functioncheckSearchChanged() {
var currentValue = $('#myTextbox').val();
if ((currentValue) && currentValue != searchValue && currentValue != '') {
searchValue = $('#myTextbox').val();
console.log(searchValue)
}
setTimeout(checkSearchChanged, 0.1);
}
$(function () {
setTimeout(checkSearchChanged, 0.1);
});
checkout working plunker here
Solution 2:
Just use keyboard command to check to see if something is happening:
$('#myTextbox').on('keydown', function () {
// do something
});
That way if someone ever types into it you will know. Else if you are trying to find out indirectly, you can use something that will check whenever an input is being used, so like:
$('input').on('keydown', function () {
var checkDiv = $('#myTextbox').val();
if(checkDiv != ""){
// do something
}
});
Post a Comment for "Detect An Indirect Update To A Field With Jquery"