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