autokana – jQuery plugin
Autokana is a jQuery plugin that automatically converts latin (roumaji) to kana (hiragana / katakana) using the auto-correct principle (keep in mind that it’s not suitable for converting copy/pasted but only typed-in text). You can check out how it works at autokana example page.
You can also download the plugin (including a simple usage example) from github and use it for free.
To use it, you will have to add the following somewhere at the beginning of your body tag:
1 2 3 4 5 6 7 | <script type="text/javascript"> // bind events when document is ready $(document).ready(function() { // attach auto-kana plugin with default options $("#kana_text_box").autokana(); }); </script> |
After that add the input box itself wherever you need it (make sure to use the same ID in the above part and in the input field itself):
1 2 3 4 5 6 7 | <input id="kana_text_box" type="text" /> <script type="text/javascript"> // this part will clear and set focus on the input field on refresh // feel free to remove that part if you don't need it document.getElementById("kana_text_box").value=""; document.getElementById("kana_text_box").focus(); </script> |
If you have any suggestions or bug reports, feel free to leave a comment.