Loading ...

Change text to Hindi from English on typing inside text box | CodeAsp.Net

Change text to Hindi from English on typing inside text box

 /5
0 (0votes)

If you want to change text from english to hindi as you type in the textbox the following code can help you:

<html>
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <script type="text/javascript" src="https://www.google.com/jsapi">
    </script>
    <script type="text/javascript">

        // Load the Google Transliterate API
        google.load("elements", "1", {
            packages: "transliteration"
        });

        function onLoad() {
            var options = {
                sourceLanguage:
                google.elements.transliteration.LanguageCode.ENGLISH,
                destinationLanguage:
                [google.elements.transliteration.LanguageCode.HINDI],
                //shortcutKey: 'ctrl+g',
                transliterationEnabled: true
            };

            // Create an instance on TransliterationControl with the required
            // options.
            var control =
            new google.elements.transliteration.TransliterationControl(options);

            // Enable transliteration in the textbox with id
            // 'transliterateTextarea'.
            control.makeTransliteratable(['transliterateTextarea']);
        }
        google.setOnLoadCallback(onLoad);
    </script>
  </head>
  <body>

    <textarea id="transliterateTextarea"></textarea>
  </body>
</html> 

 

Live: http://jsfiddle.net/raghav_khunger/3petF/1/embedded/result/

Comments (no comments yet)

Top Posts