I have an endless cycle in the edge browser and I really can not find the fault in my code, I would like to know if someone could ask me about it !?
This function is triggered in an onBlur and validates that the input is not empty
function validate(element, message) {
if (element.attr('id') == "tel" || element.attr('id') == "cel") {
if (element.attr('id') == "tel") {
if (element.val() == "" && $("#cel").val() == "") {
message.show();
return 1;
} else { message.hide(); return 0; }
} else {
if (element.val() == "" && $("#tel").val() == "") {
message.show();
return 1;
} else { message.hide(); return 0; }
}
} else {
if (element.val() == "" || element.val() == null) {
element.focus();
message.text("Este campo es Obligatorio");
message.show();
return 1;
} else {
message.hide();
return 0;
}
}
}
this other function is in an action onClick and I send to call each one of the fields that are valid
function validacion(num) {
switch (num) {
case 1:
var x = 0;
x = x + validate($("#nombre"), $("#nombreMes"));
x = x + validate($("#app"), $("#appMes"));
x = x + validate($("#fechaN"), $("#fechaNMes"));
x = x + validate($("#rfc"), $("#rfcMes"));
x = x + validate($("#perfil"), $("#perfilMes"));
x = x + validate($("#cel"), $("#telMes"));
x = x + longitud($('#imss'), $('#imssMes'), 19,1);
x = x + longitud($('#curp'), $('#curpMes'), 19, 1);
x = x + longitud($('#rfc'), $('#rfcMes2'), 14, 1);
if (x < 1) {
var block = $('<div class="block-loading" />');
$('body').prepend(block);
$("#personal").removeClass("active");
$("#hogar").addClass("active");
$("#goFam").trigger("click");
setInterval(function () {
block.hide();
}, 300);
}
break;
I have more cases but this is the only one that gives me the error. It is worth mentioning that it only fails me in EDGE. In Chrome or Opera, no problem