Display Numbers Separated By Thousands

In this guide, we will explain how to display numbers separated by thousands. For example, one million will be displayed as 1 000 000 instead of 1000000.

Drag and drop a Text field and a JavaScript field.

image

Click the pencil icon and paste the code into the JavaScript field. Change the highlighted field id according to your text field and save the changes.

image

Please use the below code:

$( '#component-9ff3-ec35-c3e0 input' ).on( 'input', function() {
  // Get value
  var value = $( this ).val();
  // Update value
  value = value.replace( / /g, '' );
  value = value.replace( /\B(?=(\d{3})+(?!\d))/g, ' ' );
  // Set the number field value to 0 when the text field value is changed
  $( this ).val( value );
} );

Try the form:

image
image

For any questions, please contact us - [email protected] or the Formyoula in-app chat 🙂