change input type dynamically using javascript code example

Example 1: 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 2: 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'">

Tags:

Misc Example