The example in this article describes the method of javascript restricting users to only input Chinese characters. Share it with everyone for your reference. The specific implementation method is as follows:
When we want to verify the function, we must understand that if it is a Chinese character, the string length is increased by 2. If we use regular expressions, we can directly use \u4E00-\u9FA5 to solve the problem.
1. Unicode check Chinese characters
2. Only Chinese characters can be input using regular expressions