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

115
Vistas
Lea una fecha del cuadro de texto 1 y muestre la próxima fecha en el cuadro de texto 2

A continuación se muestra mi código, indique dónde estoy cometiendo un error. Textbox2 no muestra nada. código para textbox1: -

 <td> @Html.EditorFor(model => model.DailyRegister.Date, new { htmlAttributes = new { @class = "form-control", required = "required", @id = "date1",@onchange="addDates2()" } }) @Html.ValidationMessageFor(model => model.DailyRegister.Date, "", new { @class = "text-danger" }) <script> function addDates() { document.getElementById("date1").value = document.getElementById("StartDate").value; } </script> </td> code for textBox2 <td> @Html.EditorFor(model => model.DailyRegister.Date, new { htmlAttributes = new { @class = "form-control", required = "required", @id = "date2" } }) @Html.ValidationMessageFor(model => model.DailyRegister.Date, "", new { @class = "text-danger" }) <script> function addDates2() { var prev=document.getElementById("date1").value var neww= prev.setDate(prev.getDate() + 1); document.getElementById("date2").value = neww; } </script> </td>
about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

Después de hacer mi investigación, a continuación se muestra la respuesta a este escenario con detalles en los comentarios.

 <script> function nextDate3() { //Date object us work with dates. By default js will use browser's time zone and display a date as a full text string. var prev = new Date(document.getElementById("date2").value) var nextDay = new Date(prev); nextDay.setDate(prev.getDate() + 1); // SetDate() sets the day of the specified DATE and getDate() returns the day from the specified DATE document.getElementById("date3").value = nextDay.toDateString(); //toDateString() method returns only date portion of a Date object as a String } </script>
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