finaly
Thanks Daisy for reply
this is my function for checking if it's Persian(or arabic)
function checkPersian( firstChar ) {
if( typeof this.characters == 'undefined' )
this.characters = ['ا','ب','پ','ت','س','ج','چ','ح','خ','د','ذ','ر','ز','ژ','س','ش','ص','ض','ط','ظ','ع','غ','ف','ق','ک','گ','ل','م','ن','و','ه','ی'];
return this.characters.indexOf( firstChar ) != -1;
}
and I have another function which get the class or id or attribute(it does not matter) and checking with checkpersian():
function checkInput(){
jQuery( this ).css( 'direction', checkPersian( jQuery( this ).val().substr( 0, 1 ) ) ? 'rtl' : 'ltr' );
}
and this is how I call function checkInput() :
(this will check textareas)
$('textarea').change( checkInput );
$('textarea').keydown( checkInput );
$('textarea').keyup( checkInput );
My Problem is:
1- I can't understand when comment textarea become visible(user need to click to show textarea)
2-I can not figure out WYSIWYG id or class to implement for them RTL direction
P.S: sorry codes looks bad in here !