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

170
Visualizações
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 Respostas
Responde à pergunta

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