JSFiddle - React, Tailwind, and code Playground
HTML
<div lang="fa">
0123456789
<div>
54
<span id=test>1234567890</span>
676
</div>
10000
</div>
CSS
div {
font-family: monospace;
font-size: 18px;
}
span {
color: #0000ff;
}
JavaScript
//before the change in the DOM, test holds a numeral parseInt can understand
alert("Before: test holds the value:" +parseInt($("#test").text()));
//the change in the DOM
$("[lang='fa']").find("*").andSelf().contents().each(function() {
if (this.nodeType === 3)
{
this.nodeValue = this.nodeValue.replace(/\d/g, function(v) {
return String.fromCharCode(v.charCodeAt(0) + 0x0630);
});
}
});
//test now holds a numeral parseInt cannot understand
alert("After: test holds the value:" +parseInt($("#test").text()))