var val = 'http://localhost/site/someimage.jpg', split = val.split('/'); alert(split[split.length-1]);