我想使用 JavaScript 从下面检索"值":
InputMask {el: HTMLMaskElement, masked: MaskedPattern, _listeners: {...}, _value: '', _unmaskedValue: '', ...} 对齐光标: ƒ () 对齐光标友好: ƒ () el: HTMLMaskElement {input: input#l3-19_0-Input_Value.form-control.input_js.OSFillParent, _handlers: {...}} masked: MaskedPattern {value: '',lazy: true, placeholderChar: '', mask: 'aaaa0000000', definitions: {...}, ...} _changingCursorPos:11 _listeners: {} _onChange: ƒ () _onDrop: ƒ () _onInput: ƒ () _saveSelection: ƒ () _selection: {开始: 11, 结束: 11} _unmaskedValue:"aaaa1234567" _value:"aaaa1234567" 光标位置: (... 面具:(... 选择开始: (... 类型值: (...) 未屏蔽值:(...) 值:(...) [[原型]]:对象
这是记录的值:
var mask = new IMask(element, maskOptions);
我试过:
console.log(mask.value)和console.log(mask.unmaskedValue),但两者都不起作用。
使用mask.unmaskedValue
var masked = IMask(element, {
mask: /^d+$/
});
console.log(masked.typedValue);