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

121
Visualizações
Does navigator.geolocation.getCurrentPosition 'undo' javascript/html actions?

I'm not sure how to word this because I don't know exactly what's happening.

Context: I am requiring the user's location upon clicking a "Deposit" button. I use js to get their location via navigator.geolocation.getCurrentPosition(). To signal to the user we are actively checking, I want to change the text to "Please wait...".

Problem: After changing that text with javascript, all is good. UP UNTIL it gets to the location function call. Then it resets the button back to "Deposit", and only that button. All other changes on the page via js persist.

Question: What's happening underneath the hood? How do I get around this?

Relevant HTML:

<div class="custom-amt col-md-3">
   <%= submit_tag 'Deposit', class: "red-btn form-control new-deposit-btn", data: {disable_with: " Please wait..." } %>
</div>

Relevant JS:

debugger; // up until this point, button text stays as "Please wait..." which is desired behavior
navigator.geolocation.getCurrentPosition(accessAllowed, handleError); // as soon as this location function is called, button text is reverted.
about 4 years ago · Juan Pablo Isaza
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