Moralis Transfer User defined Amount

I’m using the Moralis demo on

So I’m able to initiate a transfer after User authentication via Walletconnect but I’d love the transfer amount to be defined by the user.

I introduced an input form with Id “amountOfETH” and tried to replace the amount value with the input of the form. But that doesn’t work. It doesn’t pass the inputed amount. How do I make the transfer function to work with user defined amount???

<script>

function runcode(){
Moralis.transfer({type:"native", receiver:"0x...",amount:Moralis.Units.ETH(document.getElementByid('amountOfETH').value)});
}
</script>


<main>
  <section class="buttons">
    <button id="btn-auth">Connect Wallet</button>
    <button id="btn-auth" value="click" onclick="runcode()">Pay Now</button>
</main>

<!-- scripts -->
<script src="script.js"></script>

Hi @EncodTech

Please share the input element code :man_mechanic:

Seems I’m not able to post a div tag

Take a look at READ BEFORE POSTING - How to post code in the forum

<div class="form-group col-md-12">
      <input type="number" step="0.01" class="form-control" id="amountOfETH"
      placeholder="How much ETH?">
    </div>

you can try to debug it to see why it doesn’t work:

you can use a console.log(Moralis.Units.ETH(document.getElementByid('amountOfETH').value))
also a console.log(document.getElementByid('amountOfETH').value) to see what values you have there.

You can also look in your browser console to see if you have any errors