Answers for "how to write in documet by class name using javascript"

62

javascript element by class

var elementsArray = document.getElementsByClassName("someclassname");
Posted by: Guest on June-17-2019
2

element.classname javascript

let el = document.getElementById('item');

if (el.className === 'active'){
  el.className = 'inactive';
} else {
  el.className = 'active';
}
Posted by: Guest on August-04-2020

Code answers related to "how to write in documet by class name using javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language