Why onclick works only once?

set all buttons id="idBtnForm" and only works on one, why? can someone tell me and give link where to read about it ?

let divClassForm = document.getElementById("divWindow"),
 btnForm = document.getElementById("idBtnForm"),
 clouse = document.querySelector(".styleClouse"),
 fonForm = document.querySelector(".fonForm");

btnForm.onclick = function() {
 divClassForm.style.display = "block";
 fonForm.style.display = "block";
clouse.onclick = function() {
 divClassForm.style.display = "none";
 fonForm.style.display = "none";
April 3rd 20 at 18:23
2 answers
April 3rd 20 at 18:25

Specifies a style ID — unique element name that is used to change its style and refer to it via scripts. ID in the document code should be in one piece, in other words, to meet only once.
thank you to refresh your memory - celia commented on April 3rd 20 at 18:28
April 3rd 20 at 18:27
ID can be only one per page. That's basic HTML.
Yes, thanks I realized it when a fool for a long time, forget basic. - celia commented on April 3rd 20 at 18:30

Find more questions by tags JavaScript