JSFiddle - React, Tailwind, and code Playground

HTML

<body>
    <form method="post">The chance of succes:
        <input type="number" id="chance">
        <br>How many tries:
        <input type="number" id="tries">
        <br>
        <input type="button" onclick="return calculate(getElementById('chance').value, getElementById('tries').value)" value="Calculate!">
        <br>
    </form>
</body>

JavaScript

function calculate(chance, tries) {
    console.log(chance / tries * 100);
    return false; //this will stop the form from submitting to another page
}