Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
<script src="https://code.jquery.com/jquery-3.0.0.js"></script>
  Text: <input type=text />
  <br/>
  Email: <input type=url />
  
</body>
</html>
 
function is_arabic( string ) {
  return /^[\u0600-\u06FF\u0750-\u077f]/.test(string);
}
jQuery('input:text[type!=url][type!=email]').keyup(function(){
  console.log(this.value)
  if ( is_arabic( this.value ) ) {
    console.log('yes it is')
    this.dir = 'rtl';
  } else {
    console.log( 'no it is not')
    this.dir = 'ltr';
  }
});
//jQuery('input:text').val( "Welcome! \u202Bاهلا!\u202c w!")
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers