Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

what is the syntax of putting an event listener in javascript mdn

document.querySelector('#check').addEventListener('click',check)

function check() {

    const day = document.querrySelector('#day').value
  //conditional go here 
  if(day === "Tuesday" || day === "Thursday" ){
   alert('CLASS DAY!')
  }else if(day === "Saturay" || day === "Sunday"){
   alart('weekend')
  }else{
   alert('BORRRRRINNNNNNGGGGGG!!!')
  }

}

 
PREVIOUS NEXT
Tagged: #syntax #putting #event #listener #javascript #mdn
ADD COMMENT
Topic
Name
8+4 =