I have an input field of type number which ranges from 1 to 4096 as follows:
<input max="4096" min="1" name="size" step="2" type="number" value="4096">

Iam currently using a step = 2, that result in numbers 2, 4, 6, 8, 10, ...
How can I modify the step to double the value 1 , 2, 4, 8, 16,...?
Note:
The field can contain only these values (The user shoudn't be able to insert 3 , 5 , 6, 7, ...). And it should work on both increment and decrement.
The native stepper doesn't suit your requirements. Your best bet would be to implement a custom solution.
I put together an example. Have a look at it: