№1. Как определить нажатие кнопки

if(document.getElementById('button').clicked == true)
{
   alert("button was clicked");
}

№ 2. Как проверить, нажали ли вы что-то

Здесь нам нужно будет добавить прослушиватель событий.

// get the element
const element = document.getElementById('profile_title')
// always checking if the element is clicked, if so, do alert('hello')
element.addEventListener("click", () =>…