I have two buttons on a web page (Previous and Next) and both have a function associated with their click event:
//Add click events for the next and previous buttons
document.getElementById("previous").addEventListener("click", selectSection);
document.getElementById("next").addEventListener("click", selectSection);
The code for selectSection is: