Get Attribute for image
getting attr without ID
HTML
<script src="http://4.bp.blogspot.com/-uyvTMZ3dFPs/UKHsc_ZbysI/AAAAAAAACvo/QdVAlVBbUxE/s320/1hello.jpg"></script>
<img src="http://4.bp.blogspot.com/-uyvTMZ3dFPs/UKHsc_ZbysI/AAAAAAAACvo/QdVAlVBbUxE/s320/1hello.jpg" width='400' height='400' alt='Sample_image'>
JavaScript
$(document).ready(function(){
$('img').click(function(e){
alert($(this).attr('src'));
});
});