$('img').click(function () {
alert($(this).prop('src'))
})
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.0/jquery.min.js"></script>
<img src="http://www.w3schools.com/tags/smiley.gif" />
<img src="" style="width: 10px; height: 10px; border: 1px solid;">
When I click the second image, it alerts http://stacksnippets.net/js
.
Why?