diff --git a/cocos/ui/editbox/edit-box-impl.ts b/cocos/ui/editbox/edit-box-impl.ts index 070efeb1ad..9b976c137b 100644 --- a/cocos/ui/editbox/edit-box-impl.ts +++ b/cocos/ui/editbox/edit-box-impl.ts @@ -646,7 +646,7 @@ export class EditBoxImpl extends EditBoxImplBase { const delegate = this._delegate; // input of number type doesn't support maxLength attribute const maxLength = delegate!.maxLength; - if (maxLength >= 0) { + if (maxLength >= 0 && elem.type !== 'number') { elem.value = elem.value.slice(0, maxLength); } delegate!._editBoxTextChanged(elem.value);