Good afternoon, I have a function in javascript, and it does not enter the IF, the txtTipodePlano field is filled in as "MONTHLY", it should come in, just that it falls on the else,
if (document.getElementById("<%=ckPosPago.ClientID%>").checked) {
var t = document.getElementById('txtTipodePlano').value;
if (t == "MENSAL") {
now = new Date;
var dia_atual = now.getDate();
var atual_data = toDate(document.getElementById("<%= txtDataInicio.ClientID %>").value);
var dia_escolha = document.getElementById("<%= txtDiaVencimento.ClientID %>").value;
function toDate(atual_data) {
let partes = atual_data.split('/');
return new Date(partes[2], partes[1], partes[0]);
}
if (parseInt(dia_escolha) > parseInt(dia_atual)) {
var data_tolerancia;
var total_dias = dia_escolha - dia_atual;
atual_data.setDate(atual_data.getDate() + parseInt(total_dias));
document.getElementById("<%= txtVencimentoC.ClientID %>").value = atual_data.format("dd/MM/yyyy HH:mm:ss");
var tol = (document.getElementById("<%= txtToleranca.ClientID %>").value);
atual_data.setDate(atual_data.getDate() + parseInt(tol));
document.getElementById("<%= txtDataTolerancia.ClientID %>").value = atual_data.format("dd/MM/yyyy HH:mm:ss");
} else {
var data_tolerancia;
var total_dias = dia_escolha - dia_atual;
atual_data.setDate(atual_data.getDate() + parseInt(total_dias));
document.getElementById("<%= txtVencimentoC.ClientID %>").value = atual_data.format("dd/MM/yyyy HH:mm:ss");
var tol = (document.getElementById("<%= txtToleranca.ClientID %>").value);
atual_data.setDate(atual_data.getDate() + parseInt(tol));
document.getElementById("<%= txtDataTolerancia.ClientID %>").value = atual_data.format("dd/MM/yyyy HH:mm:ss");
}
} else {
function toDate(data) {
let partes = data.split('/');
return new Date(partes[2], partes[1] - 1, partes[0]);
}
var atual_data1 = toDate(document.getElementById("<%= txtDataFim.ClientID %>").value);
document.getElementById("<%= txtVencimentoC.ClientID %>").value = atual_data1.format("dd/MM/yyyy HH:mm:ss");
var tol = (document.getElementById("<%= txtToleranca.ClientID %>").value);
atual_data1.setDate(atual_data1.getDate() + parseInt(tol));
document.getElementById("<%= txtDataTolerancia.ClientID %>").value = atual_data1.format("dd/MM/yyyy HH:mm:ss");
document.getElementById("<%= txtpropor.ClientID %>").value = null;
}
}
This is how txt is:
<asp:TextBox ID="txtTipodePlano" runat="server" CssClass="form-control"></asp:TextBox>
It goes right in ckPosPago, but it does not enter t == "MONTHLY". I have already researched, changed several times, but none of them enter the IF, thank you.