
Use document.getElementById('id') to select one element by its ID. Use document.querySelector('.class') to select the first element matching a CSS selector. Use document.querySelectorAll('.class') to get all matching elements as a NodeList. querySelector is the most versatile and modern choice for DOM selection.
Reference:
TaskLoco™ — The Sticky Note GOAT