Convert English Numbers to Persian And Arabic - jQuery persianNum

File Size: 4.65 KB
Views Total: 14584
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   
Convert English Numbers to Persian And Arabic - jQuery persianNum

Yet another jQuery plugin which converts English numbers within a specific container to Persian/Arabic and vice versa.

How to use it:

1. Insert the minified version of the jQuery persianNum plugin's script after jQuery library.

<script src="https://code.jquery.com/jquery-1.12.4.min.js" 
        integrity="sha384-nvAa0+6Qg9clwYCGGPpDQLVpLNn0fRaROjHqs13t4Ggj3Ez50XnGQqc/r8MhnRDZ" 
        crossorigin="anonymous">
</script>
<script src="persianNum.jquery.js"></script>

2. Covert English numbers to Persian.

$('body').persianNum();

3. Covert English numbers to Arabic.

$('body').persianNum({
  numberType: 'arabic'
});

4. Covert Arabic/Persian numbers to English.

$('body').persianNum({
  numberType: 'decimal'
});

5. Specify an array of HTML tags to ignore.

$('body').persianNum({
  forbiddenTag: ['SCRIPT','STYLE']
});

6. Specify an array of CSS selectors to ignore.

$('body').persianNum({
  forbiddenClass: ['EnglishNum']
});

Change log:

2018-01-19

  • v2

2017-12-07

  • Compatibility for jquery 3.x

This awesome jQuery plugin is developed by sms1989. For more Advanced Usages, please check the demo page or visit the official website.