✔️JavaScript: Why does my function execute before the button is clicked? [closed]

The removeLives function executes onload and not onClick. The goal is to subtract 1 life every time the button is clicked.

Create a border in a dynamically created div when clicked in JavaScript

Please help!!! I make a game quiz with flags as an exercise in JavaScript. In a container I create dynamically divs with the country names as choices. When the div is clicked the program iterates an …