Hi all!

I'm trying to achieve the following effect:

When you focus on an input tag, the content of the div  named 'help-
for-xxx' should appear in the #help-tip element.
And, accorgingly when you leave an input it should disappear.
Appearing and disappearing means here fadeIn and fadeOut.
Of course my solution is bad (fadeIn should wait fadeOut to complete).
I know I can attach a callback after event completion, but I don't
know how to build a solution from it.

thanks

Script follows:
$('.help').each(function() {
                var that = $(this)
                var id = this.id.replace(/help-for-/, '#')
                $(id).focus(function(){
                        $('#help-tip').html(that.html()).fadeIn()
                })
                $(id).blur(function() {
                        $('#help-tip').fadeOut()
                })
})

Reply via email to