1

I have a textarea with with attribute dir="rtl" and my text looks there good Correct order of characters

But when I'm trying to retrieve the value of textarea in JS (for example through jQuery, or through native JS), I'm receiving it in the wrong way: "שם: NAME נהרי"

Is it possible to get it in JS (not in textarea) in right way?

Greg
  • 18,111
  • 5
  • 46
  • 68
Eugene
  • 903
  • 1
  • 9
  • 25

1 Answers1

0

When you try to get data from text area the language you are using is start from right to left js parser get this from right to left. In English we write from left to right. This language is opposite so that's why you are getting this error. Write a value in a native way Write it as "נהרי NAME :שם"

jadoon
  • 1
  • 2
  • Sorry, I don't understand, what do you mean "write a value in a native way". It's already written correctly in textarea. – Eugene Mar 16 '17 at 06:14
  • I mean the value work from right to left <<<<==== in this way and you are treating it like English language ====>>>> left to right. Parser will get text from right to left. Write :שם in right site then NAME. – jadoon Mar 16 '17 at 06:27
  • Yes, it's how it was written into the textarea. My problem is that when I'm trying to get this value through JS, the order is mixed as I described above. – Eugene Mar 16 '17 at 06:30
  • Can you share js fiddle ? – jadoon Mar 16 '17 at 06:33
  • There is no way to change DOM property rtl we only can change it in css. – jadoon Mar 16 '17 at 08:02
  • 1
    We need to change it manually to reverse string property you can do this as : var a= document.getElementById("second").value; a = a.split(""); a = a.reverse(); a=a.join(""); document.write(a); – jadoon Mar 16 '17 at 08:03
  • It's not exactly what I need, but I appreciate your efforts. Thank you. – Eugene Mar 20 '17 at 05:29