1//creating a button and linking it to bClicked()
2document.onload=()=>{
3 let b = documentbody.createElement("button");
4 b.onclick = bClicked;
5}
6
7function bClicked(){
8 //yourID is the id of element that you want to fullscreen
9 document.getElementByID("yourID").requestFullscreen();
10}
11
12//to exit fullscreen
13document.exitFullscreen();