I am working on a 'mad libs' type of program in HTML- basically the user is asked a series of questions and upon hitting submit, the script prints a story with their answers.
How do I make it so that, when the user writes their answer, they can hit enter and the new question will appear? I want the questions to be revealed one by one- only after the user has answered the previous question. So it is kind of similar to an animation. Is there a way to do this?
window.writeValues = function(form) {
var Greeting = form.Greeting.value;
var fname = form.fname.value;
var celebrity = form.celebrity.value;
document.getElementById('RESULT').innerHTML = Greeting + " " + fname + " it's " + celebrity;
}
<form action="PayslipServlet" method="get">
Please enter your First name: <input type="text" name="fname" id="fname"><br/>
Please enter a celebrity:<input type="text" name="celebrity" id="celebrity"><br/>
Please enter a greeting: <input type="text" name="Greeting" id="Greeting"><br/>
RESULT: <span id="RESULT"></span><br />
<input type="button" value="Submit" onClick="writeValues(form)">. <input type="reset">
</form>