Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

212
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda