document.addEventListener('click', actionClick ); function actionClick(event) { const button = event.button; const x = event.clientX; const y = event.clientY; const newElement = document.createElement('p'); newElement.textContent = `Click ${button} at position (${x},${y})`; document.querySelector("body").appendChild(newElement); }