I need to replace dot character on entered by the user by the comma . I wrote this code but it doesn't give the hopped result
$(".dot").keyup(function (event) {
val = $(this).val();
length = val.length;
if (event.key == '.') {
event.stopPropagation();
$(this).val(val.substring(0, length)+",");
}
});
have you tried using the string method replace?
var res = str.replace(".", ",");