Attaching both mouseenter and mouseleave event handlers using jQuery
First of all you can use jQuery hover and passing 2 functions (mouseenter, mouseleave)
and u can shorten it also with jQuery end

$('.foo').hover(
    function () {
        $(this).find('h1').addClass("hover").end().find('input').focus();            
    },
    function () {
        $(this).find('h1').removeClass("hover").end().find('input').val('');            
    }
);