format (number);
number. A number.
The format method returns string view of a number.
To execute the example, the HTML page must contain links to the PP.js library and PP.css styles. Add a value editor:
//Create a number editor
var ne = new PP.Ui.NumberEdit({
ParentNode: document.body,
Width: 50
});
//On changing a value in the number editor the console displays string view of the entered number
ne.AfterValueChange.add(function (sender, args) {
numbForm = new PP.NumberFormat();
value = args.NewValue;
formValue = numbForm.format(value);
console.log("String value: " + formValue)
});
After executing the example the page contains the NumberEdit component that looks as follows:
On changing the value editor value the browser console will show string view of the entered value.
See also: