Hey there! I've got an interesting problem. I currently have three text boxes on my webpage, and what I want to achieve is having a fourth text box generated when the user clicks a button. The content of this new text box should be filled with the data from the other three boxes. So far, I've been successful in accomplishing this using the following code:
<html>
<head></head>
<body>
<script>
function addTextBox() {
var element = document.createElement("input");
element.setAttribute("type", "text");
element.setAttribute("id", "Text4");
document.body.appendChild(element);
fill();
}
function fill() {
input = document.getElementById("Text1").value + " " + document.getElementById("Text2").value + " is " + document.getElementById("Text3").value;;;
document.getElementById('Text4').value = input;
}
</script>
<form>
<input type="text" id="Text1" value="Firstname">
<input type="text" id="Text2" value="Lastname">
<input type="text" id="Text3" value="Age">
<input type="button" onclick="addTextBox()">
</form>
</body>
</html>
But here's where I need assistance - I want to take the age entered by the user in the third textbox and convert it to their age in days before displaying it in the fourth box. Can anyone provide guidance on how to achieve this?