How to Auto detect input writing position in JQuery

View: 332    Dowload: 0   Comment: 0   Post by: hanhga  
Author: none   Category: HTML-CSS template   Fields: Other

9 point/1 review File has been tested

When we write right to left language characters in textarea the direction of the writing will automatically be changed from right to left and vice versa

Introduction

When we write right to left  language characters in textarea the direction of the writing will automatically be changed from right to left and vice versa

Example: JQuery .

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><script>
$(document).ready(function() {
 $("#txt_post_contents").on("mousemove mouseleave keyup", function () {
 var post_contents = $.trim(document.getElementById("txt_post_contents").value);
  
 if(post_contents.length == 1||post_contents.length == 2){
 var langType = new RegExp("[\x00-\x80]+");
 var AsciiPostContents = langType.test(post_contents);
  
 if(AsciiPostContents){
 $("#txt_post_contents").css('direction','ltr');
 }
 else{
 $("#txt_post_contents").css('direction','rtl');
 $("#txt_post_contents").css('font-size','16px');
 }
 } 
 });
});
</script>

Example: Html.

<textarea id="txt_post_contents" name="txt_post_contents" rows="3"></textarea>

How to Auto detect input writing position in JQuery

How to Auto detect input writing position in JQuery Posted on 31-08-2016  When we write right to left language characters in textarea the direction of the writing will automatically be changed from right to left and vice versa 9/10 332

Comment:

To comment you must be logged in members.

Files with category

 

File suggestion for you

File top downloads

logo codetitle
Codetitle.com - library source code to share, download the file to the community
Copyright © 2015. All rights reserved. codetitle.com Develope by Vinagon .Ltd