Search
 
SCRIPT & CODE EXAMPLE
 

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
  )
}
Comment

PREVIOUS NEXT
Code Example
Javascript :: vue get props into data 
Javascript :: make image circle css react 
Javascript :: react state add to array 
Javascript :: how to get contrast from a color using js 
Javascript :: imagebackground in react native 
Javascript :: javascript order array by date 
Javascript :: fillstyle 
Javascript :: discord.js random message 
Javascript :: usedispatch 
Javascript :: postgresql update json field key value 
Javascript :: mock window jest js 
Javascript :: Custom jquery validation messages 
Javascript :: add css in javascript 
Javascript :: js promis with ajax 
Javascript :: navigate-to-an-anchor-on-another-page 
Javascript :: js remove query param from url 
Javascript :: moment date is in range 
Javascript :: apa itu this pada javascript 
Javascript :: javascript dataurl to blob 
Javascript :: jquery debounce 
Javascript :: auto increment schema mongoose id 
Javascript :: object element by index javascript 
Javascript :: js string array convert to int 
Javascript :: js domtokenlist to array 
Javascript :: convert to datetime in jquery 
Javascript :: firebase.database is not a function 
Javascript :: javascript transpose rows to columns 
Javascript :: react image compression 
Javascript :: jquery modal if clicked outside 
Javascript :: how to get date using tolocaledatestring 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =