// select all elements with a custom class var elements = document.querySelectorAll(".myClass"); // change the properties in the elements to whatever you want elements.forEach(e => { e.value = "test" e.setAttribute("style", "display: none;") })