I\'m creating a button dynamically using JavaScript and at the same time assigning attributes such as \'ID\', \'type\' etc and also \'onclick\' in order to trigger a functio
In case this question is passed as a dupe, here is how to do it in current browsers
ES6
backButton.addEventListener("click",() => history.back());
Older but newer than onclick
backButton.addEventListener("click",function() { history.back() });