Ryo
Ryo

Reputation: 1035

Javascript - Input number only by latin and Japanese

How can my input accept only numbers written in latin charset or Japanese: I googled it but just can get result of latin charset only, not utf-8 supported.

Example: 13 and 13 is accepted

Upvotes: 0

Views: 971

Answers (1)

Oriol
Oriol

Reputation: 288470

Use HTML5 pattern validation

<input pattern="[\d\uff10-\uff19]*" />

\d matches a digit (character in the 0-9 range).

\uff10-\uff19 matches a character in the 0-9 range.

* means zero or more times.

Upvotes: 4

Related Questions