Jquery focusout event triggerd twice on input text field

153 views Asked by At

i'm working on a web application in mvc and generated textbox with loop so the id of every textbox in unique and on the focusout event of every textbox check the validation through ajax. The problem is focusout event is triggered twice automatically and show twice value of every textbox and pass twice value, i d'ont know what the reason. My code is given below. Highly Thankful to all of you!

$('#StartTime0').focusout(function () {
                if ($(this).val() && $('#EndTime0').val()) {
                    var MonTime1 = checkTime($(this).val(), $("#EndTime0").val())
                    if (MonTime1) {
                        $("#Onelimit0").addClass("hidden");
                        console.log($(this).val());
                        console.log($('#EndTime0').val());
                        //DoctorTimeCheck($(this).val(), $("#EndTime0").val())                        
                    }
                    else {
                        $("#Onelimit0").removeClass("hidden");
                    }
                }
                else {
                    $("#Onelimit0").addClass("hidden");
                }
            });
0

There are 0 answers