Published on

Detect when element is ready in DOM with element-ready

Authors

There might be case in which we might want to detect/wait until a element is ready in the DOM before performing some operation.

For such case, element-ready might be a good choice.

Dependency

npm install element-ready

Snippet

import elementReady from 'element-ready';
const element = await elementReady('#example');
// it'll wait until the element #example is ready in the DOM

console.log(element.id); //=> 'example'

Happy better scripting!