I have a function called by two different HTML elements and each of the elements calls the function through a certain event.
$("#tempoInicial").on("blur", manipulaTempoFinal);
$("#operadorTempo").on("change", manipulaTempoFinal);
function manipulaTempoFinal() {
var tempoInicial = $("#tempoInicial");
var operador = $("#operadorTempo");
if (operador.val() == "4" && tempoInicial.val() != "") {
tempoFinal.removeAttr("disabled");
$("#tempoInicial, #operadorTempo").rules("remove", "skip_or_fill_minimum");
$("#tempoInicial, #operadorTempo, #tempoFinal").rules("add", {
require_from_group: [3, ".temposOperadorWeb"],
messages: {
require_from_group: "Ao entrar com tempo inicial e escolher o operador \"Entre\" o campo tempo final passa a ser obrigatório."
}
});
} else {
tempoFinal.attr("disabled", "disabled");
tempoFinal.val("");
$("#tempoInicial, #operadorTempo, #tempoFinal").rules("remove", "require_from_group");
$("#tempoInicial, #operadorTempo").rules("add", {
skip_or_fill_minimum: [2, ".temposOperadorWeb"],
messages: {
skip_or_fill_minimum: "Ao preencher o tempo inicial selecione o operador ou vice-versa."
}
});
}
}
Is there any way in the lastManage function to identify who called it and / or what event?