I am writing a NPM package and I want to write something to the DOM inside my function. But I get an error saying the document is not defined example,
foo package:
module.exports = {
sayHello: function(){
document.getElementByID('#hello').innerHTML('Hello');
}
}
In client-side javascript:
import { sayHello } from 'foo';
$('#myButton').click(() => sayHello());