I have two HTML pages: index.html and confirmation.html.
In index.html, there is a form:
<form>
<label id="labelforename">Forename</label>
<input type="text" name="textforename">
<label id="labelsurname">Surname</label>
<input type="text" name="textsurname">
<input type="button" onclick="myFunction()"></input>
<script>
function myfunction(){
setTimeout(function() {window.location = "confirmation.html" });
}
</script>
</form>
In confirmation.html there is a page whose purpose is confirming the entered first name and surname.
<body>
<div id="write"><p>Your name is: </p></div>
<script>
function show() {
document.getElementById("write").innerHTML = textforename;
document.getElementById("write").innerHTML = textsurname;
}
</script>
</body>
How can I pass forename and surname through the 2 pages and display it on the confirmation page?
Is it done by storing the forename and surname in a cookie on index.html and then getting it again when on the confirmation page and displaying it?
This needs to be done in jQuery or plain JavaScript.