Yeganeh Salami
Yeganeh Salami

Reputation: 595

Reactjs change keyboard language auto to persian

I have a form in reactjs.some of the inputs must fill in persian but without using ALT+SHIFT keys. I found some code in javascript and i have tried How to change TextBox input language to Persian as you type in. but its not working. can anybody help me that how can i change my keyboard language in reactjs? or is there any way to mapping chrecters in javascript?

Upvotes: 0

Views: 1259

Answers (1)

Yaser
Yaser

Reputation: 5719

The easiest way is to add lang attribute to your input using jquery or hard coded:

$().ready(function () {
    $("input#NameTextBox").attr("lang", "fa");
});

In addition to above code you also need to add the reference to farsitype a library to handle the language in your head tag.

<script language="javascript" src="FarsiType.js" type="text/javascript"></script>

More info here.

Upvotes: 1

Related Questions