zakkudesu
8/22/2019 - 1:30 AM

Keyboard & Input Events DOM

//KEYBOARD & INPUT EVENTS

const form = document.querySelector('form');
const taskInput =  document.getElementById('task');
const heading = document.querySelector('h5');
const select = document.querySelector('select');

//Clear input
taskInput.value = '';

// form.addEventListener('submit', runEvent);

//Keydown
// taskInput.addEventListener('keydown', runEvent);

//Keyup
// taskInput.addEventListener('keyup', runEvent);

//Keypress
// taskInput.addEventListener('keypress', runEvent);

//Focus
// taskInput.addEventListener('focus', runEvent);

//Blur
// taskInput.addEventListener('blur', runEvent);

//Cut
// taskInput.addEventListener('cut', runEvent);

//Paste
// taskInput.addEventListener('paste', runEvent);

//Input 
// taskInput.addEventListener('input', runEvent);

//Change
select.addEventListener('change', runEvent);

function runEvent(e){
  console.log(`EVENT TYPE: ${e.type}`);

  // console.log(e.target.value);

  // heading.innerText = e.target.value;

  //get input value
  // console.log(taskInput.value);

  // e.preventDefault();

}