When the FocusOut event is raised, how do you know which element receives the focus?
The correct way seems to be to use the event\'s relatedTarget p
I have encounter the same problem using textEditor PrimeFaces element.
I use the following html code.
The TextArea is defined twice so that when form is displayed, the user see only the first
When user click on text displayed, the focusin() event hide the
To do that, I have defined the following javascript code
function onLoadDialog()
{
jQuery(".text-editor").hide();
jQuery(".div-focus").focusin(function()
{
$(this).hide();
$(this).next(".text-editor").show();
$(this).next(".text-editor").focus();
});
jQuery(".text-editor").focusout(function(e)
{
if ($(e.relatedTarget).closest(".text-editor").size() == 0)
{
$(this).hide();
$(this).prev(".div-focus").show();
$(this).prev(".div-focus").text($(this).text());
}
});
}
The onLoadDialog function() is called when page is loaded and is used to hide