Notice 1
Notice 1
Selecting Elements
`document.getElementById('id')` - Selects an element by its ID.
`document.getElementsByClassName('class')` - Selects elements by their class name.
`document.getElementsByTagName('tag')` - Selects elements by their tag name.
`document.querySelector('selector')` - Selects the first element that matches a CSS selector.
`document.querySelectorAll('selector')` - Selects all elements that match a CSS selector.
Modifying Attributes
`element.getAttribute('attribute')` - Gets an attribute's value.
`element.setAttribute('attribute', 'value')` - Sets an attribute's value.
`element.removeAttribute('attribute')` - Removes an attribute.
Styling Elements
`element.style.property = 'value'` - Sets inline style for a property.
`element.classList.add('class')` - Adds a class to the element.
`element.classList.remove('class')` - Removes a class from the element.
`element.classList.toggle('class')` - Toggles a class on the element.
Event Handling
`element.addEventListener('event', function)` - Attaches an event handler.
`element.removeEventListener('event', function)` - Removes an event handler.