+ 2
Please I need anyone answer me on my Question about Button? Please write the code.
How can I make 5 buttons when I click on the first button letter 'A' appear in textbox and second button letter 'B' and third button letter 'C' and fourth button letter 'D' and fifth button letter 'E'
5 Answers
+ 4
I recommend you to go through HTML, JavaScript and CSS courses, you will not regret it ! :)
It's a nice feeling when you learn it and become able to solve it yourself
+ 4
</head>
<body>
<p></p>
<script>
var p = document.querySelector("p");
var B1 = document.createElement("button");
document.body.appendChild(B1);
B1.innerHTML = "A";
B1.addEventListener("click", AddB1, false);
function AddB1(){ p.innerHTML += B1.innerHTML;}
var B2 = document.createElement("button");
document.body.appendChild(B2);
B2.innerHTML = "B";
B2.addEventListener("click", AddB2, false);
function AddB2(){ p.innerHTML += B2.innerHTML;}
</script>
</body>
+ 3
<body>
<button onclick = "NewB()">button</button>
<script>
function NewB(){
var Bname = document.createElement("button");
document.body.appendChild(Bname);
Bname.innerHTML = "Button";
Bname.addEventListener("click", NewB, false);
}
</script>
</body>
+ 2
I try but I can't do that so I ask for help
+ 2
thanks for your answer Emore Anzolin