// note that its the return false; that prevents the page refresh. <button onclick="alert('Hello'); return false;">Click</button>