+ 3
How to use a button multiple times.
After pressing a button it disappear and executes the function, but i want to not press the button just once.
4 Respuestas
+ 3
Maybe you can replace abutton with a clickable div. It can help
+ 10
Your button isn't gone, it's just hidden behind the output.
Very simple fix:
Html:
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<button id="btn1" onclick="btn()">=</button>
<div id="output"></div>
</body>
</html>
JS:
function btn(){
var btn2=document.getElementById("btn2");
var out = document.getElementById("output");
out.innerHTML="Hey! What are you doing?";
}
Simply added a div and then changed innerHTML of it. The div is positioned after the button, so it remains visible.
+ 8
Could you publish your code at the playground and add a link to it in your post?