Change locale for number input form control?

I am having problem creating a number form control.
The generated control has input restriction to only numeric digits and “.” (decimal point).
However, I want to input number with thousand separator (‘,’).

I have tried using javascript to edit entered text, however, the input box does not allow the comma (thousand separator).

$('.numeric').on('input', function () {
        // Get the current value of the input
        let value = $(this).val();

        //alert('test numeric');

        // Remove any non-digit characters from the input
        value = value.replace(/[^\d]/g, '');

        // Add thousand separators to the input value
        value = Number(value).toLocaleString(undefined, {groupingSeparator: '-'});

        // Set the formatted value back into the input
        $(this).val(value);
    });

I also tried adding custom local to config file but this does not help:

'Number' => [
        'locale' => 'en-US',
        'thousandSeparator' => ','
    ],

I also tried to change locale of that form input but also does not work:

echo $this->Form->control('est_total', ['label' => 'Cost Estimation', 'empty' => true, 'type' => 'text' ,'step' => 'any', 'locale' => 'en-US', 'templateVars' => ['extra_class' => 'numeric', 'ctnClass' => 'col-md-3']]);

I also tried to create that form control using HTML code, not the CakePHP form helper, but also did not work.

Can someone help me with that. Thanks you very much

Is your function even being called? Is the string you have in value after modifying it what you expect? It’s very unclear just where the problem you’re experiencing is happening.

The control call you’ve shown is setting the input type to text, which should allow any data to be in it, so I feel like the problem is not in anything Cake related.

The JavaScript is called every tick of the keyboard input.
I just press the 1 key on keyboard with down releasing, I can see the value is changed to

111,111,111,111,111,111 .....

then immediately changed back to
111.1111111111

I realized that I have another block of javascript somewhere else applied to the same input, which does the change.

Thank you Zuluru for your quick response.

I think this thread can be closed now.