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

185
Views
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 answers
Answer question

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