var submitButton = document.getElementById('submitButton'); submitButton.setAttribute('onclick', 'alert("hello");');