Advertisement
Guest User

Untitled

a guest
Feb 20th, 2019
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. <input onchange="alert('value changed!');" />
  2.  
  3. document.getElementById("my_text_input").onchange = function(){
  4. alert("value changed!");
  5. }
  6.  
  7. (function(){
  8. var changed = false;
  9.  
  10. document.getElementById("my_text_input").onchange = function(){
  11. changed = true;
  12. }
  13. document.getElementById("my_text_input").onblur = function(){
  14. if (!changed) {
  15. //Your logic here
  16. }
  17. changed = false; //set it back to false for next loss of focus
  18. }
  19. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement