JSFiddle - React, Tailwind, and code Playground

by nukeboy212

HTML

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>date of birth</title>
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css">
</head>https://jsfiddle.net/nukeboy212/nf3awxr9/1/#
<body>
    <main>
        <div id="div1">
            <h1>Age in days</h1>
        </div>
        <form id="user_input" onsubmit="return false" >
            <input id="age_years" type="number" placeholder="Put your age in years">
            <input type="submit" class="btn btn-success" id="submit_button" onclick="ageInDays()">   
        </form>  
        <div>
            <p id="finalText">This is your age in days: <span id="span">0</span>  </p>
        </div>
    </main> 
    <script src="app.js"></script>
</body>

JavaScript

"use strict"
 var done1 = false
function ageInDays() {
if (done1){

}
else{
    let ageInYears = document.getElementById("age_years").value;
    let ageDays = ageInYears * 365;
    // para.appendChild(text);
    document.getElementById("span").textContent= ageDays;
   done1 = tue;
   // $("#span").html(ageDays)
}