Advertisement
ph4x35ccb

prenchendo div com value do input automaticamente

May 16th, 2019
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var myDiv = document.querySelector('div'),
  2.     myInput = document.querySelector('input');
  3.    
  4. var myTimeout;
  5.  
  6. myInput.addEventListener('keyup', function(){
  7.     clearTimeout(myTimeout);
  8.     myTimeout = setTimeout(()=>{
  9.             myDiv.textContent = this.value;
  10.     },1000);
  11. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement