I have an img tag in HTML with a source image; then I would on mouseover to switch the image to another image; exactly the image I set in the rel attribute.
and then on mouseout, switch back to the source image.
I wrote this script but it does not work; the issue is surely due to the wrong use of "element" but I was not able to solve.
function hover(element) {
  $(element).fadeOut(1000, function(element) {
    element.setAttribute("src", element.attr("rel"));
  }).fadeIn(1000);
  return false;
}
function unhover(element) {}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<img id="image" 
     src="http://www.google.com/logos/2011/trevithick11-hp.jpg" 
     rel="http://www.google.com/logos/2011/mothersday11-hp.jpg" 
     onmouseover="hover(this);" 
     onmouseout="unhover(this);" 
     />
When solved I will focus on the mouseout event