Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

find all images without alternate text

// find all images without alternate text and give them a red border
function processImages() {
  // Get all images
  const images = document.querySelectorAll('img')

  // Loop through all images
  images.forEach(image =>
    // If the image has no alt attribute give it a red border
    !image.alt ? (image.style.border = '1px solid red') : null
  )
}
 
PREVIOUS NEXT
Tagged: #find #images #alternate #text
ADD COMMENT
Topic
Name
8+8 =