How to replace Jquery and each input value - only numbers

I want change (translated) value input english number to persian (arabic) number and show in input:text, How is it?

<input type="text" value="سلا 22 کمس 22" class="halohol">

$('.halohol').val(function(index, value) {
    var rep = {
        '0': '&#1776;',
        '1': '&#1777;',
        '2': '&#1778;',
        '3': '&#1779;',
        '4': '&#1780;',
        '5': '&#1781;',
        '6': '&#1782;',
        '7': '&#1783;',
        '8': '&#1784;',
        '9': '&#1785;',
        ':': ':',
    }
    var val = $('.halohol').val();
    alert(rep['1']);

    var arr = value.split("");

    //for (i = 0; i < arr.length; i++) {
    //str += rep[arr[i]];
    //}
    //$(arr).each(function(idx, val) {
        //return value.replace('2', rep[i]);
    //})
});

DEMO: http://jsfiddle.net/prxsLL3d/

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.