You need to find the image, use prop(or attrif you have jQuery 1.5 or lower) to get the property src, and then regex to get the part you need.
Your code might look like this:
alert($('#yourImageId').prop('src').match(/(\w*)\.\w{3,4}$/)[1]);
This assumes that the image does not have non-word characters (i.e. only A-Za-z0-9_) and that its file extension has a length of 3 or 4 characters. If this is not the case, you will have to change it.
source
share