Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 140854

How to convert dispatchEvent for a customevent for IE11?

$
0
0

This function below doesn't work on IE11, because IE11 is not supporting dispatchEvent and CustomEvent.

How can I convert this function to let it work on IE11?

I tried to add a variable which returns true/false if the browser is IE11, and based on that disable the dispatchEvent code. But that didn't work.

Any ideas how I can let this code work on IE11?

 function disableLoader(dataElement) {
    const dataElement = document[0].querySelector('[data-id]');
    const dataElementId = dataElement.getAttribute('data-id');

    dataElement.dispatchEvent(new CustomEvent('dataLoaded', {
        detail: {
            dataId: dataElementId,
            status: 'finished'
        }
    }));
}

Viewing all articles
Browse latest Browse all 140854

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>