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

164
Vistas
javascript on onclick="return func();" stop working after first element by id
<button onclick="return validateEdit();" class="btn btn-primary submit-btn">Submit</button>

function validateEdit() {
  var name = document.getElementById("sftName").value;
  aler("name")
  var startTime = document.getElementById("startTimeEdit").value;
  aler("start time")
}

The function execute first alert and don't show second aler.I am using also:

$('#edit_shift').on('show.bs.modal', function (event) {
  var anchor = $(event.relatedTarget) // Button that triggered the modal
  var id = anchor.data('whatever')
  var from = anchor.data('fromtime')
  var modal = $(this)
  $("#sftName").attr("value", name);
  $("#startTimeEdit").attr("value", from);

In the another form is working fine.

Edit: start time with value and without value is not working in both cases.

I am full zero at javascript.

about 4 years ago · Santiago Gelvez
1 Respuestas
Responde la pregunta

0

There are some typo error. Make sure its alert in your code and not aler. Also html content you posted having only button, whereas you are trying to fetch two elements with id sftName and startTimeEdit, make sure those elements are there in your code. For better understanding can you recreate above issue on codepen.

about 4 years ago · Santiago Gelvez 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