How can i add a reset function in my code? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

How can i add a reset function in my code?

Tic Tac Toe Game - Reset Function/Button https://code.sololearn.com/WNAn819vsjek/?ref=app

11th Jul 2017, 4:40 PM
Melvin
Melvin - avatar
3 Answers
+ 2
Add a button like: <button onclick="reset ()">Reset</button> create a JavaScript function that loops through each number from 1 to 9 and clear the values: function reset(){ for(i = 1; i < 9; i++){ document.getElementById(i.toString()).value = ""; } }
11th Jul 2017, 5:16 PM
Limitless
Limitless - avatar
+ 3
This code includes a reset function: https://code.sololearn.com/WHrsYeZM65I3/?ref=app
3rd Nov 2017, 6:26 PM
Shane Overby
Shane Overby - avatar
+ 1
i think we have reset value type for input tag.. like <input type="reset" value="reset">
14th Jul 2017, 9:43 AM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar