dynamically add input fields to form code example

Example 1: how to change to input of a form dynamically

<input type="text" name="chance" value="50"
    onkeyup="document.getElementById('payout').value='1/'+this.value+'x 98'">

Example 2: how to change to input of a form dynamically

Chance: <input type="text" name="chance" value=""
   onkeyup="document.querySelector('input[name=payout]').value=this.value?1/this.value*98:''">

<br/><br/>Payout: <input type="text" name="payout" value=""><br/>

Example 3: how to change to input of a form dynamically

<input type="text" name="chance" value="50"
onchange="document.getElementById('payout').value='1/'+this.value+'x 98'">

Tags:

Misc Example