You can extend jQuerys selectors like this (doesn't quite work yet,
sorry):
$.extend($.expr[':'],{
jpg: function(a) {
return $(a).filter('img').attr('href').split('.').pop().match(/
jp/i);
// return $(a).is(img[href$='jpeg']); also could work
}
});
Will let you do this:
Wow, is that function in the first post overly complicated
isJpg = function(src) {
return src.test(/\.[jpg|jpeg]$/i);
}
would do the trick (i'll note: untested though as it's off the top of
my head)
On Jan 6, 1:01 pm, David Hulbert dave1...@gmail.com wrote:
You can extend jQuerys
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)
3 matches
Mail list logo