document.querySelector('#id-name');
document.getElementById('id-name');
document.querySelectorAll('.class-name');
document.getElementsByClassName('class-name');
const p = document.createElement('p');
div.append(p);
div.appendChild(p);
div.prepend(p);
div.before(p);
div.after(p);
p.remove();
div.removeChild(p);
button.addEventListener('click', function() {
});
button.onclick = function() {
};
function myFunction() {
};
<button onclick="myFunction">Click me</button>
JS properties are written using camelCase instead of dashes like in CSS.
let element = document.querySelector('#id-name');
element.style.backgroundColor = 'red';
let element = document.querySelector('#id-name');
element.classList.add('class-name');
let element = document.querySelector('#id-name');
element.classList.remove('class-name');
let element = document.querySelector('#id-name');
element.classList.toggle('class-name');