$(".testimage").on("focusin focusout",function(event) { $(".details", this).toggle(event.type == "focusout") })