<input type="submit" value="Go" class="button"> <script> var button = document.querySelector('.button'); button.onclick = function() { alert('Кнопка нажата'); }; button.click(); </script>