regex is the way to go, but just out of curiosity: $('img').is('[src$=.jpg],[src$=.jpeg],[src$=.JPG],[src$=.JPEG]')
On Jan 6, 3:03 pm, the_woodsman <elwood.ca...@gmail.com> wrote: > Hi all, > > I have a function that determines (a bit hackily!) if an image is a > jpeg. > > isJpeg=function(src) > { > mySplit=src.split('.'); > extension=mySplit[mySplit.length-1]; > isJpg=(extension=='jpg' || extension=='jpeg' || > extension=='JPG' || > extension=='JPEG'); > > return isJpg; > }; > > I think I might be able to rewrite this as a JQ selector involving the > image's src attributes, something like: > $('img').filter("img[src*!='.jpg']") > > But I can't get this to work- and I'm especially unsure how to do the > variations of the extension in an OR clause. > > Any tips? > > Thanks!