Is it possible to have a button on a webpage triggered both by clicking with the mouse and hitting the spacebar?
HTML
<div class="col-12 button small-button">
<a onclick="generator()">
<img src="icones%20web%20projeto.png" title="Descubra um novo artista" alt="New Image">
</a>
</div>
JS
function generator() {
var x= Math.floor((Math.random()*35)+1);
console.log(x);
document.getElementById('divImage').innerHTML='<img src="img/'+x+'.png">';
}