TransWikia.com

Click Event does not get fired in SPFX Extension in IE 11

SharePoint Asked by Akshay Belure on December 28, 2021

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.

2 Answers

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

Answered by Baker_Kong on December 28, 2021

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');
  });
}

Answered by Prasanna Ruwangana on December 28, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP