how to call out again the functions in javascript?

Tags: , ,



I watched the JavaScript tutorial of cleverprogrammer at youtube then I saw his rock, paper, scissors game. I thought of an idea to add some function in his game that will reset or will move onto next round. But when I try the remove() or document.getElementById('id name of my form').remove(), it will clear what is in the frontend but I don’t know some command that will show the game again and when I used the reset() is showing some error: Uncaught TypeError: document.getElementById(...).reset is not a function.

The program:

rock, paper, scissor

output

is there some other way or command that will show the game again?

Answer

The reset() method resets the values of all elements in a form. At W3school, You can read in detail about reset property. But if you want to get the removed element back again, For this you can use the "detach" property.

For more info, check this link: https://www.w3schools.com/jquery/html_detach.asp



Source: stackoverflow