How can replace arabic number with latin number as that doesn’t change number into div:style and doesn’t change tag and … ? How can done it?
DEMO: http://jsfiddle.net/mCUvT/
<div class="myGrid">
<b style="top: 50px;">123456789-10-11-12</b>
<br />
<span style="margin: 20px 0 10px 5px">05-10-1390</span>
<a href="http://blog.jsfiddle.net/" style="left: 20px">our blog</a>
</div>
var grid= $(".myGrid");
grid.html(grid.html().replace(/0/g,"۰"));
grid.html(grid.html().replace(/1/g,"۱"));
grid.html(grid.html().replace(/2/g,"۲"));
grid.html(grid.html().replace(/3/g,"۳"));
grid.html(grid.html().replace(/4/g,"۴"));
grid.html(grid.html().replace(/5/g,"۵"));
grid.html(grid.html().replace(/6/g,"۶"));
grid.html(grid.html().replace(/7/g,"۷"));
grid.html(grid.html().replace(/8/g,"۸"));
grid.html(grid.html().replace(/9/g,"۹"));
Okay, It took sometime to crack down the decoding part.. but it worked out well.. I think you can’t convert just replace the whole html, instead you need to parse down each
#textNodeand convert them. See below recursive function which checks for textNode and converts them.DEMO
DISCLAIMER: Please note that the below code is a draft version and definitely a lot of improvements can be done.. I will leave it to you or other SO users to correct me on that..
CODE: