I have an input field with a default value of $1. I want to change that value to say $5 and then click a button. I used the following code to try to achieve this:
function run() {
var trade_amount = document.querySelectorAll('.value__val input')[0];
trade_amount.value="";
trade_amount.value = '$5';
trade_amount.blur();
const call_button = document.getElementsByClassName("btn btn-call")[0];
call_button.click();
}
The issue is that every time the button is clicked, the $5 or any value I put into the input field changes back to the default $1 before clicking. So, it clicks with the default value rather than the value I changed it to. How do I solve this issue?