I wrote this code to replace some chars in a string:
$(".rtl:not(.num)").keypress(function(e)
{ var key = (e.keyCode || e.which);
var vlu = $(this).val();
var charTyped = String.fromCharCode(key);
if (charTyped=='ك')
{ vlu.replace(/ك/g,'ک');
alert("keh"); }
if (charTyped=='ي')
{ vlu.replace(/ي/g,'ی');
alert("yeh"); }
alert(vlu);
});
After the code executes, vlu
has not changed. What is wrong?