javascript - Fire change event although not focused -



javascript - Fire change event although not focused -

is possible bind event handler input field fired, value changes although not focused?

thank you.

from jquery official documentation :

the alter event sent element when value changes. event limited elements, boxes , elements.

so in jquery:

$( "#bar" ).change(function() { alert( "handler .change() called." ); });

you don't have such functionality available in pure javascript. in case could, define function checks value of input , periodically using setinterval method (from relvant post):

var foo = document.getelementbyid("bar"); var oldvalue = foo.value; function checkifvaluechanged() { if(foo.value != oldvalue) { //necessary code trigerred on value alter clearinterval(checker); } } //every 500ms check if value changed var checker = setinterval('checkifvaluechanged()', 500);

i hope gets started in right direction.

javascript

Comments

Popular posts from this blog

Delphi change the assembly code of a running process -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -

C++ 11 "class" keyword -