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

180
Visualizações
How to generate UIUD using button without refreshing the whole page

enter image description here

here is my javascript on how im generating the UIUD and Regenerate Secret are my HMTL. I know to not refresh the whole page I need a type='button' in the button element, but when i add that, i am not loading up anything using my onClick. I really don't understand why adding type= button would break this. Thanks for the help!

about 4 years ago · Santiago Gelvez
1 Respostas
Responde à pergunta

0

This is too weak as an answer since your problem isn't clear yet. Anyway it's a step to show that the problem lies elsewhere. As you can see that's how a button should behave (while being of type button).

But you should include your javascript as text, instead of picture, if you want it to be included here.

function onClick(event){
  const uuid = generateUUID();
  document.getElementById('status')
    .textContent = `a new UUID:${uuid} was generated!`;
}

function generateUUID(){
  return '12345' + Math.floor(Math.random() * 9999);
}
button{
  cursor: pointer;
  margin-bottom: 1rem;
}

#status{
  border: dashed 2px gray;
  padding: 1rem;
}
<button type="button" onclick="onClick(event);">Generate UUID</button>

<div id="status"></div>

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