Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8176129
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T23:02:44+00:00 2026-06-06T23:02:44+00:00

I have this function var map = [ &\#1632;,&\#1633;,&\#1634;,&\#1635;,&\#1636;, &\#1637;,&\#1638;,&\#1639;,&\#1640;,&\#1641; ]; function getArabicNumbers(str) {

  • 0

I have this function

var map =
[
"&\#1632;","&\#1633;","&\#1634;","&\#1635;","&\#1636;",
"&\#1637;","&\#1638;","&\#1639;","&\#1640;","&\#1641;"
];

function getArabicNumbers(str)
{
    var newStr = "";

    str = String(str);

    for(i=0; i<str.length; i++)
    {
        newStr += map[parseInt(str.charAt(i))];
    }

    return newStr;
}

which is taken from How can I view Arabic/Persian numbers in a HTML page with strict doctype?

This function will only work if you put something between the parenthesis in getArabicNumbers() when you call out for it.

I want to apply this function on the document from its beginning to its end! how can I do that? Is it possible in javascript? do you recommend it?

any other way to replace English numbers to Arabic numbers using javascript (on the full page not on a string)?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T23:02:45+00:00Added an answer on June 6, 2026 at 11:02 pm

    You need to walk the DOM tree and for each textnode call replace with the getArabicNumbers.

    I would change the getArabicNumbers function to a regex probably; all you need to do is match 0-9 and then map it using a callback.

    Edit:
    Here’s a little fiddle I put together for the fun of it and to demonstrate what I’m talking about and it seems to work perfectly although I am a little unsure about the Right-To-Left part…

    Edit2:
    D’oh… You can even do without the map[] array.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a function in jquery: $('#map').click(function(e) { var posX = $(this).offset().left, posY =
I have got this code: function init(){ if (typeof window.jQuery !== 'function') { var
I have this code: _trackit: function(){ for(var key in this.items.sublinks){ switch(key){ case 'shoes': for(var
I have this function and I want to make the var category to have
I have this function where I am getting the name of a Venue: var
I have this code here: var Person = (function() { var name; var PersonConstructor
I have this code: $('.user_info').click(function(){ var pos = $(this).offset(); rel_value = $(this).attr('rel'); $('#' +
I have this jQuery script that works fine: $(select).change(function () { var finalPrice =
I have this code in jquery : $(#order_btn).click(function(){ var totalprice = $(.price_amount).text(); $(#totalprice).val(totalprice); });
Let's say I have this $(document).ready(function() { var array = $.makeArray($('p')); $(array).appendTo(document.body); }); });

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.