0
How to create renewable button js
I need to create button that shows random non-fraction number when clicked. And it mustn't to disappear after click (work lots of times)
3 Respostas
+ 2
Try this:
HTML
<button onclick="myFunc()"></button>
<p id="num"></p>
JavaScript
function myFunc(){
randNum = Math.floor(Math.random()*100);
document.getElementById("num").innerHTML = randNum;
+ 1
Just let me know if you'd like some explanation of it or if you get any errors. It's most important that you understand what's happening in the code!
0
is it what you need
https://codepen.io/Renat90/pen/mwMjdy