add event listener by id code example

Example 1: javascript addeventlistener

var element = document.getElementById("#id");
element.addEventListener('click', function(){
	console.log("click");
});

Example 2: js addeventlistener

var element=document.getElementById("some_id");
var listener=element.addEventListener('click',function(event){                          
            
 });

Example 3: js add event listener

function eventHandler(event) {
  if (event.type == 'fullscreenchange') {
    /* gestire un interruttore a schermo intero */
  } else /* fullscreenerror */ {
    /* gestire un errore di commutazione a schermo intero */
  }
}