I need to do a check on the page to check if certain images are loaded, i.e. does not return 404. If they are available, I want to replace the image with default images.
I know that I can assign an onerror handler for images.
Firstly, I need to use a selector to find all images that have a source that contains the following image name → /folder/Product_1234_P.jpg OR / folder / Product_9876_Q.gif
Any ideas how I can create a high performance selector that I can use to search for such images so that I can check if the images are loaded if they do not replace the image name: Product_Default_P.jpg or Product_Default_Q.gif
Any help or advice would be wonderful.
source
share