简体   繁体   中英

javascript to find images

I am trying to find the images on a page using the following:

var Images = jQuery('img[src$=".jpg"], img[src$=".jpeg"]');  

However, it does not find something that does not have the jpg extention like http://s1.reutersmedia.net/resources/r/?m=02&d=20121204&t=2&i=681048372&w=460&fh=&fw=&ll=&pl=&r=CBRE8AM1T7A00

How can i find such images..

If you don't want to filter on only .jpg images, then simply looking for image elements should suffice:

var $images = $('img');

Or if you only want images with a source, then:

var $images = $('img[src]');

Try

var $images = $('img[src]');

Selects all images that have a source..

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM