$(document).ready(function() {
$("img").each(function() {
$(this).attr('alt',$(this).attr('alt')+" - Copyright (c) John Doe");
});
});
$(this)
refers to the current image in each loop.
$(this).attr('alt')
get's the current attribute alt
$(this).attr('alt','value')
this is how you assign value
to the alt
attribute
$(this).attr('alt',$(this).attr('alt')+" - Copyright (c) John Doe");
so code here replace the current
with current
+ " - Copyright (c) John Doe"
Errors in your code
$img
is not defined.
append
deals with adding html content
s to the element not the attribute