Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

210
Views
Cuando un usuario selecciona startDate y endDate, quiero que la fecha de inicio se muestre en otro cuadro de texto

Quiero seleccionar la fecha de inicio de este campo: @Html.EditorFor(model => model.TimePeriod.StartDate, new { htmlAttributes = new { @class = "form-control datepicker", @id="StartDate",@onchange= "addDates()" } }) @Html.ValidationMessageFor(modelo => modelo.TimePeriod.StartDate, "", new { @class = "text-danger" })

Aquí quiero autocompletar esa fecha de inicio aquí

 <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>

Ejecutar el código anterior da este resultado

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Puede ser una pregunta tonta, pero ¿ha intentado obtener el valor del campo de fecha de inicio en su lugar?

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

Dependiendo de cuándo llame a la función addDates() , es posible que también necesite un detector de eventos.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!