开发者

Limit the text field characters to 50 - cannot find function slice in Object 0

I am using this to limit the characters in the Text Field.

textField.value = textField.value.slice(0,50);
textField.value = textField.value.replace(/[^0-9]+/, "");

I am getti开发者_如何学运维ng an error, cannot find function slice in Object 0.


Use substr

textField.value = textField.value.substr(0,50);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜