Just as the live text field we will use the same parameters, but the inputType will be "number" and it is important to add a few attributes, like step and min. Step allows decimals, in the following example 2 decimals, one decimal at a time.
For Decimals
array_push($td_fields,[ 'type'=>'live', 'inputType' => 'number', 'col'=>'balance', 'privilege'=> 2, //optional, 4 will show the field only to High and Admin privileges, default is 1 'class'=>'', //optional, class name selector default: none (empty) 'attributes'=>'min="0" step=".01"' //optional ]);
For Integers
If we only want to allow integers step should be equal to 1 and to prevent decimals add the following JS to the attributes: onkeypress="return event.charCode >= 48 && event.charCode <= 57"
array_push($td_fields,[ 'type'=>'live', 'inputType' => 'number', 'col'=>'balance', 'privilege'=> 2, //optional, 4 will show the field only to High and Admin privileges, default is 1 'class'=>'', //optional, class name selector default: none (empty) 'attributes'=>'min="0" step="1" onkeypress="return event.charCode >= 48 && event.charCode <= 57"' //optional ]);