I'm trying to add several attributes to all my img tags but I'm not
sure if they're both working. Could you verify if these are correct?

$(document).ready(function(){
//add the width and height for each image
$('img').each(function(){
   $(this).attr('width', $(this).width());
   $(this).attr('height', $(this).height());
});

//copy alt to title
$('img').attr('title', function(){
   $(this).attr('alt');
});
});

Am I doing the right thing?

Reply via email to