title: jQuery replace English Number array with Arabic Number array
body: <p>I have many spans on my page with this class</p>
  
  <pre><code>&lt;span class="price"&gt;AED &amp;nbsp;2129&lt;/span&gt;
  &lt;span class="price"&gt;AED &amp;nbsp;4129&lt;/span&gt;
  </code></pre>
  
  <p>I want to use jQuery to find all the spans and then replace the AED with the Arabic word of Dirham and also replace the numbers with Arabic numbers.</p>
  
  <p>This is my current code I have been trying for some hours.</p>
  
  <pre><code>jQuery('span.price').val(function(i,val) {
  
      // text
      var en_currency = "AED";
      var ar_currency = "درهم";
  
      // array
      var f = ['0','1','2','3','4','5','6','7','8','9', en_currency];
      var r = ['٠','١','٢','٣','٤','٥','٦','٧','٨','٩', ar_currency];
  
      var valArray = val.split(' ');
      jQuery.each(valArray, function(i,v){
         var inF = jQuery.inArray(v, f);
         if(inF !== -1){
           valArray[i] = v.replace(f[inF], r[inF]);
         }
      });
      return valArray.join(' ');
  });
  </code></pre>