I'm making an age checker just for fun and I'm having trouble with this. I want a code that creates following:
<form action="proceed.html">
<input type="submit" value="Proceed" />
</form>
in a condition. If the age >= 13, create the button. This is what I have so far.
function agechecker() {
var uiage = document.getElementById("uiage").value;
var uiageop = "";
if (uiage > 0 && uiage < 115) {
if (uiage >= 13) {
uiageop = "You have successfully met/surpassed the age requirements!"
<!--Add button here-->
} else {
uiageop = "You are too young to meet/surpass the age requirements."
}
} else {
uiageop = "Please enter a valid age."
}
document.getElementById("ageverifyop").innerHTML = uiageop
}
<div class="agechecker">
<h1>Check your age!</h1>
<label>Your age: <input type="number" placeholder="Enter age" id="uiage"></label>
<label><input type="submit" onclick="return agechecker()"></label>
<h4 id="ageverifyop"></h4>
</div>