0

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?

Community
  • 1
  • 1
Yeganeh Salami
  • 575
  • 7
  • 29

1 Answers1

1

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.

Yaser
  • 5,609
  • 1
  • 15
  • 27