EDITTTT:
You are using x
as a global variable and is probably getting changed from something else in your code. Use var x = my_var.toString().length;
(emphasis on var
)
Honestly after seeing this code I was afraid there would be many more underlying problems but all I did was add var
before the xyz
and it works just as you want it to.
Also fixed the issue of the previous bet amount returning to the input field. It now results to a blank field.
Cheers