[jQuery] focus and blur event problem

[jQuery] focus and blur event problem


I have this code to insert an HTML tag before an input field (input
type="text" id="edit-title").
var myText = '<div id="msg">This is a message</div>';
$("#edit-title").focus(function() {
$(this).before(myText);
});
$("#edit-title).blur(function() {
$(".nodemsg").remove();
});
Sometimes the focus event is called twice, for example if browser
window is resized (firefox 3). Is possible to solve this problem ? I
need to check if myText is inserted before focus event ?
Thanks!