Getting just the filename from a path with Javascript

Posted by DCD on Stack Overflow See other posts from Stack Overflow or by DCD
Published on 2010-03-26T19:19:58Z Indexed on 2010/03/26 19:23 UTC
Read the original article Hit count: 129

Filed under:
|
|
|

I have a full path to an image, which I am using jquery to read, in the form $('img.my_image').attr('src') however I just want the filename portion (discarding the path).

Are there any built-in functions to do this, or would a regex be the only option?

© Stack Overflow or respective owner

Related posts about html

Related posts about JavaScript