<script type="text/javascript"> $('a img').each(function(){ var img = $(this); var a = img.parent(); a.attr({src:img.attr('src'),title:img.attr('title')}) ; }); </script>