[jQuery] Can I use a selector instead of this fn to check for .jpg?
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!