Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

218
Visualizações
When a user selects startDate and endDate, I want start date to be displayed in other text box

I want to select the startDate from this field: @Html.EditorFor(model => model.TimePeriod.StartDate, new { htmlAttributes = new { @class = "form-control datepicker", @id="StartDate",@onchange="addDates()" } }) @Html.ValidationMessageFor(model => model.TimePeriod.StartDate, "", new { @class = "text-danger" })

Here I want to autopopulate that start date here

<td>
                    @Html.EditorFor(model => model.DailyRegister.Date, new { htmlAttributes = new { @class = "form-control", required = "required", @id = "date1" } })
                    @Html.ValidationMessageFor(model => model.DailyRegister.Date, "", new { @class = "text-danger" })
                    <script>
                            function addDates() {
                            document.getElementById("date1").value = document.getElementById("StartDate");
                        }
                    </script>
                </td>

Running above code gives this result

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

It might be a silly question, but have you tried getting the value of the start date field instead?

document.getElementById("date1").value = document.getElementById("StartDate").value;

Depending on when you call the addDates() function you might need an event listener as well.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda