how to assign class to a div in javascirpt code example Example: javascript give class to element element.classList.add("div-class");