This will only get you the first image filename in the document - to get all
of them, use something like this:

  var filenames = [];
  $('img').each(function(){
    filenames.push($(this).attr('src').split('/').pop());
  });

now filenames contains the filenames of all the images in the page


David .Wu wrote:
> 
> 
> I got it, thanks everyone.
> $('img').attr('src').split('/').pop();
> 
> 
> On 4月28日, 下午6時39分, Remon Oldenbeuving <r.s.oldenbeuv...@gmail.com>
> wrote:
>> I dont think there's a real jQuery way, you could use regular  
>> expressions, or maybe split the string with .split('/')
>>
>> On 28 apr 2009, at 10:36, "David .Wu" <chan1...@gmail.com> wrote:
>>
>>
>>
>> >  images/xxx.gif 
>>
>> > $('img').attr('src') -> This will get images/xxx.gif
>> > How to get xxx.gif by jQuery?
> 
> 

-- 
View this message in context: 
http://www.nabble.com/How-to-get-file-name-tp23272719s27240p23275342.html
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to