+ 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'

18th Mar 2017, 2:56 AM
Kirollos Ayman
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
18th Mar 2017, 3:12 AM
Albert Kunz
Albert Kunz - avatar
+ 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>
18th Mar 2017, 5:52 AM
Emore Anzolin
Emore Anzolin - avatar
+ 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>
18th Mar 2017, 5:26 AM
Emore Anzolin
Emore Anzolin - avatar
+ 2
I try but I can't do that so I ask for help
18th Mar 2017, 3:17 AM
Kirollos Ayman
+ 2
thanks for your answer Emore Anzolin
18th Mar 2017, 8:26 AM
Kirollos Ayman