Increment the value in a TextBox using the Arrow Inside the Box

362 Views Asked by At

enter image description here

In an automation code, I want to fill the text-box with a number greater than 0. setvalue() doesn't work. A user would have to click on the up arrow (see picture) to make the text-box editable. How can I make this happen?

 <input aria-invalid="false" autocomplete="off" class="MuiInputBase-input MuiOutlinedInput-input MuiInputBase-inputMarginDense MuiOutlinedInput-inputMarginDense" id="yieldGoal" name="yieldGoal" placeholder="0.00" type="number" min="0.01" step="0.01" data-test="new-program-form__yield-goal-input" value="0.00"> 

So far I have attempted to set the attributes step, value with a value large than 0.0. It did not work.

$('#yieldGoal').setAttribute('step', "2.0")

Increment the value in the text-box

2

There are 2 best solutions below

3
On

Please use val to set the value of an input element.

$('#yieldGoal').val("2.0");

Hope this will solve the issue.

0
On

if this is texbox and you use jQuery try

$('#yieldGoal').val("2.0")