If you want to be able to easily change the extension list, I suggest refactoring the whole thing :
function getLinkExtensionsSelector(extensions) { return jQuery.map(extensions, function(ext){ return 'a[href$=.'+ext +']'; }).join(','); } var $links = jQuery('.post').find(getLinkExtensionsSelector(['png', 'gif', 'jpg'])); On Jan 17, 10:57 pm, Mike Alsup <mal...@gmail.com> wrote: > > variety, yes: > > > $('.post a').filter('[href$=.png],[href$=.jpg],[href$=.gif]') > > > On Jan 17, 7:02 pm, Karl Swedberg <k...@englishrules.com> wrote: > > > > On Jan 17, 2009, at 3:52 PM, Mike Alsup wrote: > > > > >> I use a light-box plugin on my > > > >> website,http://www.FreeSoftwareWorkshop.com > > > >> and I need to select the links that end in .png, .jpg or .gif. > > > >> This is how I use the selector (it works only for .png): > > > > >> $(function(){ > > > >> $(".post a[href$=.png]").lightBox({ > > > > >> }); > > > >> }); > > Karl and Ricardo, > > Well played, my friends! :-) > > Although I half expect Klaus to come along and lay down a 20 char > trump card! :-) Where are you, Klaus?