I have a community web site and I want that users write
Actually the Arabic alphabet letters are these
var RTL = ['ا','ء','ب','ت','ث','ج','ح','خ','د','ذ','ر','ز','س','ش','ص','ض','ط','ظ','ع','غ','ف','ق','ک','ل','م','ن','و','ه','ی'];
and Persian (Farsi) alphabet letters are these
var RTL = ['ا','ب','پ','ت','ث','ج','چ','ح','خ','د','ذ','ر','ز','ژ','س','ش','ص','ض','ط','ظ','ع','غ','ف','ق','ک','گ','ل','م','ن','و','ه','ی'];
and it can be useful if check the first and second letter because sometimes it can starts by a bullet or something like that.
for ( var index = 0; index < divs.length; index++ ) {
if( checkRtl( divs[index].textContent[0] ) || checkRtl( divs[index].textContent[1] ) ) {
divs[index].className = 'rtl';
} else {
divs[index].className = 'ltr';
};
};