I have the next code working correctly:

```
var links = document.getElementsByClassName('register');
for(var index = 0; index < links.length; ++index)
{
   links[index].addEventListener('click', function(){
       var newMixpanelEvent = 'mixpanel.track("Click On Searched List", {"user is logged": "no"})';
       trackEvent(newMixpanelEvent);
       });
}

```

This is just listening for a click event, and then executing a function to create an event to Mixpanel. 

Now I need to check the `addEventListener` function and `attachEvent` to make it work almost all browsers, so I do:

```
var links = document.getElementsByClassName('register');
for(var index = 0; index < links.length; ++index)
{
   if( links[index].addEventListener ) {
       links[index].addEventListener('click', function(){
           var newMixpanelEvent = 'mixpanel.track("Click On Searched List", {"user is logged": "no"})';
           trackEvent(newMixpanelEvent);
           });        
   } else if( links[index].attachEvent ) {
       links[index].attachEvent('onclick', function(){
           var newMixpanelEvent = 'mixpanel.track("Click On Searched List", {"user is logged": "no"})';
           trackEvent(newMixpanelEvent);
           });
   }
}

```

But this is not firing the events. Seems like `if( links[index].addEventListener )` is not passing. Any idea of why?