0

I have created one spfx extension of type application customizer. I have attached click event to setting icon span.But when I click on setting icon it does not get fired.

This is working fine in Chrome, Firefox,IE edge but not working in IE 11,

Following is the code..

 const settingIcon = document.getElementsByClassName(SETTINGS_ICON)[0];
  if (settingIcon != null) {
    settingIcon.addEventListener("click", ()=> {
    alert('Hi')            
  });

Thank you.

1
  • Hello, maybe provide a screenshot of your console in IE? that would help us solve your case :)
    – Edwin
    Commented Jul 27, 2020 at 10:40

2 Answers 2

1

I tested your code in a spfx extension and it works well in IE, the click event get triggered.

enter image description here

Test demo:

BR

0

IE11 doesn't support arrow functions. Use function instead.

var settingIcon = document.getElementsByClassName(SETTINGS_ICON)[0];

if (settingIcon != null) {
  settingIcon.addEventListener("click", function () {
    alert('Hi');
  });
}
1
  • tried..but didn't work Commented Jul 26, 2020 at 12:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.