[Solved] JQuery .focus() not work in .blur() event in Firefox


    $("#txtfname").focus(function () {
     //Check if value is blank or not
     if ($("#txtfname").val() === "" && $("#txtfname").val().length >= 2) {
         $("#fnamemsg").hide(); // Hide message
     }
 });

var element = document.getElementById('txtfname');
 element.focus();
 element.onblur = function () {
     if (element.value !== "" && element.value.length < 2) {
         $("#fnamemsg").show();
         $("#fnamemsg").html("* Firstname required 2 character");
         setTimeout(function () {
             element.focus();
         }, 0);
     } else {
         $("#fnamemsg").hide();
     }
 };

4

solved JQuery .focus() not work in .blur() event in Firefox