nedash says:
$(function () {
$(
'[id*=Txtvam]'
).keyup(function (e) {
var ctrlKey = 67, vKey = 86;
if
(e.keyCode != ctrlKey && e.keyCode != vKey) {
$(
'[id*=Txtvam]'
).val(toPersianNumber($(
this
).val()));
}
});
});
$(function () {
$(
'[id*=Txtpar]'
).keyup(function (e) {
var ctrlKey = 67, vKey = 86;
if
(e.keyCode != ctrlKey && e.keyCode != vKey) {
$(
'[id*=Txtpar]'
).val(toPersianNumber($(
this
).val()));
}
});
});
function toPersianNumber(input) {
var inputstring = input;
var persian = [
"۰"
,
"۱"
,
"۲"
,
"۳"
,
"۴"
,
"۵"
,
"۶"
,
"۷"
,
"۸"
,
"۹"
]
for
(var j = 0; j < persian.length; j++) {
inputstring = inputstring.toString().replace(
new
RegExp(j,
"g"
), persian[j]);
}
return
inputstring;
}
replace above code with below
function pageLoad() {
$('[id*=Txtvam]').keyup(function (e) {
var ctrlKey = 67, vKey = 86;
if (e.keyCode != ctrlKey && e.keyCode != vKey) {
$('[id*=Txtvam]').val(toPersianNumber($(this).val()));
}
});
$('[id*=Txtpar]').keyup(function (e) {
var ctrlKey = 67, vKey = 86;
if (e.keyCode != ctrlKey && e.keyCode != vKey) {
$('[id*=Txtpar]').val(toPersianNumber($(this).val()));
}
});
function toPersianNumber(input) {
var inputstring = input;
var persian = ["۰", "۱", "۲", "۳", "۴", "۵", "۶", "۷", "۸", "۹"]
for (var j = 0; j < persian.length; j++) {
inputstring = inputstring.toString().replace(new RegExp(j, "g"), persian[j]);
}
return inputstring;
}
}