Am trying to build a function that takes the inner text from an HTML button, and maps it onto a variable. The below function is working, is there a way to map the innterText from the button it is activated by onto the dir var?
When I console.log ~ this ~ I get the path to the website from my computer.
function otterSummon() {
removeImages();
var imgCount = 79;
var dir = 'otters/';
var randomCount = Math.round(Math.random() * (imgCount - 1)) + 1;
var otterImage = document.createElement('img');
otterImage.src = dir + images[randomCount];
otterImage.setAttribute("id", "memeImage");
var container = document.getElementById("containerMain");
container.appendChild(otterImage);
console.log(this)
console.log(otterImage);
}