First add the jquery file by including following following line
Jquery library:
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
Html:
<img width="75px" height="75px" border="0" alt="Top Tech" src="http://unitedassemblers.com/Artwork/Blank.jpg">
Jquery:
$(document).ready(function(){
var name = $('img').attr('src');
var fileNameIndex = name.lastIndexOf("/") + 1;
var filename = name.substr(fileNameIndex);
if(filename='Blank.jpg')
{
alert('image name is '+filename);
}
})
Live Demo :
Click here for live demo
0 comments: