Use querySelectorAll

This commit is contained in:
zandercymatics 2024-01-18 13:31:18 -07:00
parent a9253b6689
commit 3d7c651c72
No known key found for this signature in database
GPG key ID: FF4636ABEC9682B7

View file

@ -286,7 +286,7 @@ function removeFormErrors(input, removeStaleAlerts=false){
} }
if (removeStaleAlerts){ if (removeStaleAlerts){
let staleAlerts = Array.from(document.getElementsByClassName("usa-alert--error")) let staleAlerts = document.querySelectorAll(".usa-alert--error")
for (let alert of staleAlerts){ for (let alert of staleAlerts){
// Don't remove the error associated with the input // Don't remove the error associated with the input
if (alert.id !== `${input.id}--toast`) { if (alert.id !== `${input.id}--toast`) {