I think what you are looking for is focus/blur rather than click
$('.wrapper input').focus(function () {
$(this).parent().addClass('red');
}).blur(function () {
$(this).parent().removeClass('red');
});
Demo: Fiddle
If you still want click then try this