mercredi 4 avril 2018

How to make event.target property working within the function expression

I have list of items and i need to get the classname by clicking on a specific list item.But i cannot access the event.target property within the funciton.I have a function and an eventlistener.Eventlisteners are within the eventListnerInit function.So when i click on a list item i cannot make the event.target property to work inside the deleteitems function expression

let fntaskController = (function (taskEvent, UIrender, taskstorage) {

     //setupeventlistner
 let eventListnerInit = function () {             
  document.querySelector(taskEvent.dom.deleteEvent).addEventListener('click', deleteItems.bind(this.event));

     }

     let deleteItems = function (ev) {

         //delete list items   
     }

    return {
     init: function () {
         //Event Listner Initilization
         eventListnerInit();
     }
 }

 })(fninputevnt, fntaskUI, fntaskLocalStorage);

 fntaskController.init();




Aucun commentaire:

Enregistrer un commentaire