Instantly format text input

I want to write a code that should automaticly seperate value with comma. For example while I’m entering the value 10000, code should make 10.000. How can I do?

This is usually done with a regex. Google for “regex format number” and you’ll prob. find the answer. Regex’s can be added to a text element thru editor or set thru code.

I see. I figured out how it works. But I’ve got 2 text input. I created a filter between two values. I want to format while user entering the number. For example while user is typing 1000 automaticly format 1.000. I hope I could explain myself :slight_smile:

As Giri already told you, you can do it by using RegEx, or you do it by using a Combination of →

.replace()
.substring()
.slice()
and all the other given STRING-methods.

If you want to see the change live, while typing in the value, then you will need it to place inside → onChange()

With every typing letter into your inputfield, the → onChange event will be fired up.

@russian-dima I’ll try this as soon as possible thanks man! :slight_smile:

@ramazanbugdayci02
Take a look here …
https://www.w3schools.com/jsref/jsref_obj_string.asp

1 Like

@russian-dima I’m going to use methods in order to
1- take value from input
2- get length of input and take mode 3
3- insert a comma result index
4- merge all strings and done ?

Do you think this algortihm will work? :slight_smile:

@ramazanbugdayci02
I would say, it will be your challenge, so —> try it out :wink:

@russian-dima I don’t have much time. The project’s deadline is cominng! :smiley:

@ramazanbugdayci02
Sorry, but i do just help. I do not a payed job. Don’t forget that.
The deadline is not my problem.