There are a number of ways to bind events in JavaScript. A simple way is to create the handler (a function), and set it equal to onclick.
// explicit way
function SayHello() {
alert('Hello World');
};
var toggleButton = document.querySelector('.toggle-publications');
toggleButton.onclick = SayHello;
// implicit way.
toggleButton.addEventListener("click", SayHello);
function SayHello() {
alert('Hello World');
};