* Return the current formatted value of the AutoNumeric element as a string * * @usage anElement.getFormatted() * * @param {function|null} callback If a callback is passed, then the result is passed to it as its first argument, and the AutoNumeric object as its second *
(callback = null)
| 2504 | * @returns {string} |
| 2505 | */ |
| 2506 | getFormatted(callback = null) { |
| 2507 | if (!('value' in this.domElement || 'textContent' in this.domElement)) { |
| 2508 | // Make sure `.value` or `.textContent` exists before trying to access those properties |
| 2509 | AutoNumericHelper.throwError('Unable to get the formatted string from the element.'); |
| 2510 | } |
| 2511 | |
| 2512 | const result = AutoNumericHelper.getElementValue(this.domElement); |
| 2513 | this._executeCallback(result, callback); |
| 2514 | |
| 2515 | return result; |
| 2516 | } |
| 2517 | |
| 2518 | /** |
| 2519 | * Return the element unformatted value as a real Javascript number. |
no test coverage detected