Returning page in initial state

Returning page in initial state

I have a button "show form" and hidden form, when i click on a button form appears, after i filled the form i send info in alert. How can i return page at initial state(like just having only one button). Also would be great to hear some tips what can i do better

script looks like this 
$( document). ready( function () {
$( "#form"). hide();
$( "#showForm"). click( function () {
$( "#form"). show();
$( "#showForm"). hide();
});
$( "#alertButton"). click( function () {
var name = $( "#name"). val();
var bday = $( "#bday"). val();
var gender = $( "input[name=gender]:checked", "#form"). val();;
var agreement;
var favColor = $( "#favColor"). children( "option:selected"). val();
if ( $( "#agreement"). prop( "checked") == true) {
agreement = "Да";
}
else
agreement = "Нет";
alert( "Имя: " + name +
" \n Пол: " + gender +
" \n Дата рождения: " + bday +
" \n Любимый цвет: " + favColor +
" \n Согласие на обработку данных: " + agreement
);
});
});