VNKeys is a powerful and intuitive JavaScript library designed to enable users to type in Vietnamese effortlessly on any browser and device. Recognizing the challenges of inputting Vietnamese text, especially for users unfamiliar with specialized keyboards, VNKeys provides a seamless typing experience with support for multiple popular Vietnamese input methods. Yes, it works mobile devices.
Check out live demo vnkeys.net for more details.
VNKeys supports five input modes:
- OFF: Disables Vietnamese input, allowing standard typing.
- AUTO: Automatically detects and applies the appropriate input method based on the user's typing patterns.
- VIQR: A traditional input style using ASCII characters like
a^,o^, anddd. - VNI: Popular among Vietnamese users, using numerical codes (e.g.,
a1,a2) for tone marks and accents. - TELEX: A modern and intuitive method with combinations like
aafor â orddfor đ.
By integrating VNKeys into your website or web application, you're empowering users with the ability to write in Vietnamese smoothly, whether they're on a desktop, tablet, or mobile device. Say goodbye to cumbersome workarounds and hello to seamless Vietnamese input with VNKeys!
-
Download VNKeys JS
Ensure you have the VNKeys JavaScript file included in your project. Place it in an accessible location, e.g.,js/vnkeys.js. -
Include the Script in Your HTML
Add the VNKeys script to your HTML file using a<script>tag:<script src="path/to/vnkeys.js"></script> or <script src="https://vnkeys.net/raw.htm?skey=vnkeys_js"></script>
-
Add Input Method Selector
Include radio buttons for selecting the input method. Use theVNKeys.setMethod()function to switch between input modes:Methods: <input name="vnkeys_method" type="radio" value="off" onchange="VNKeys.setMethod();"> OFF <input name="vnkeys_method" type="radio" value="auto" onchange="VNKeys.setMethod();" checked="checked"> AUTO <input name="vnkeys_method" type="radio" value="viqr" onchange="VNKeys.setMethod();"> VIQR <input name="vnkeys_method" type="radio" value="vni" onchange="VNKeys.setMethod();"> VNI <input name="vnkeys_method" type="radio" value="telex" onchange="VNKeys.setMethod();"> TELEX
You can also use VNKeys.setMethod("auto")
-
TextArea Example
To enable VNKeys functionality, use a<textarea>or<text>element with thedata-vnkeysattribute. This attribute activates the Vietnamese input feature.<textarea data-vnkeys autofocus="autofocus" id="txtTest" style="width:99%; height:200px;"></textarea> <input data-vnkeys type="text" />